Simple CSS question

Soldato
Joined
1 Feb 2006
Posts
8,188
Hi,

Just testing a site here in IE7 and I have italic font within one div. In the next div I want this to be normal but it seems to inherit from the above div. What is the best practice here... declare font-style:normal in the body tag and then change to just italic in the required div so that everything else will inherit from the body tag? Or is there anything like a "clear:font" function that will stop any inherited font behaviour? I have never came across anything like it but it could be handy. I'm guessing just adding font-style definitions to all subsequent divs would be the solution but it seems a bit extra hassle if you have a lot of content.

This issue only appears in IE7 so maybe its just a bug for it only. Any suggestions?
 
It's usual to have a global style, and then you alter it for individual sections as required. You can specify manually in the DIV itself, or you could give the DIV a CLASS pertaining to that layout, and then just use that class definition to style the italic text. The advantage of referring to classes is that if you wanted to change it in the future, you could just update the div.class {} definition instead of having to manually edit all of the HTML.
 
Yeah I usually would do that but in this occasion the italics seemed to have been inherited. It just seemed to be an IE specific bug....Nothing new there I guess! I would say I am pretty confident with CSS after doing quite a bit with it but just thought the inheritance thing was a bit weird. Thanks for the help.
 
Back
Top Bottom