Hassan
Hassan

Reputation: 2843

CSS/HTML - padding issue on Firefox and style override

My first issue:

Because of some weird problem with Firefox I have to put these :

margin:0;
padding:0;

in every div with background img to avoid problems on Firefox. I have no problem with these But sometimes I need to use padding-top to make some distance between text and it's above.

If I use both padding:0 and padding-top:2px then the problem is still there. How can I use padding-top while having the fix for Firefox?

Second one:

I used a global CSS code for all tags on my page. For example I used the color:FFF on all tags. But sometimes I need to have a specific link to be color:000. like this one:

<div style="color:000"><a href="#">blabla</a></div>

As you know this way I can't make the 'blabla' link in black color, Because I already have style applied for <a> tags so it will be in white again. How can I achieve this one?

Upvotes: 0

Views: 1518

Answers (3)

icirellik
icirellik

Reputation: 766

To override the color you can add a class to your stylesheet as such:

/* Global Link Override */
a:link {
  color:FFF;
}

/* Specific Link Override */
.specialLink a:link {
  color: 000;
}

You can then apply it to the link as such, the first will be white and the second black:

<a href="#">foo</a>
<div class="specialLink"><a href="#">bar</a></div>

Upvotes: 0

Beatriz Oliveira
Beatriz Oliveira

Reputation: 659

About the padding, you can add an extra div inside the previous one, just for padding.

<div>
  <div class=PaddingStyle>Content</div>
</div>

That way you will keep your fixed div intact.

About your second question, try adding !important to the second style

a {color:#000 !important;}

Upvotes: 3

bsegraves
bsegraves

Reputation: 1020

In response to #1:

When you say "padding:0", you're saying to set the padding for all directions - left, top, right, and bottom to "0". If your "padding-top:2px" appears before your "padding:0", then your "padding-top:2px" will be ignored.

If you want to modify your styles based on the browser, then I recommend css browser select. I've used this before and found it quite handy.

Upvotes: 0

Related Questions