Forum Moderators: not2easy

Message Too Old, No Replies

Is this code redundant

or does it have a purpose?

         

HelenDev

10:47 am on Jul 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In the code I have inherited, there is a lot of stuff like this

P, p{
color:#000000;
}

and stuff like BODY,body TEXTAREA,textarea

Is there a reason for this or should I just remove the uppercase ones?

Tippy

11:52 am on Jul 7, 2005 (gmt 0)

10+ Year Member



Off the top of my head, I think css sort of 'inherits' the case sensitive nature of XML if it's served up as 'application/xhtml+xml', rather than as text.

That is <div class="foo"> will be unaffected if the style sheet says .FOO {whatever}.

If memory serves it may also be a NN4 compatibility thing, but I've no paperwork to back that up.

alias

12:52 pm on Jul 7, 2005 (gmt 0)

10+ Year Member



Yes, CSS is case-sensitive. They probably decided it was the best way to assign p,P's without overwriting the code itself.

encyclo

2:11 pm on Jul 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As HTML is case-insensitive, the CSS rules are too. The examples you have given are completely redundant whatever case your HTML is in. I suspect that the stylesheet was used for a site with mixed-case markup and the person was just making sure. Unless I'm mistaken (I'll let the real CSS experts correct me!) I know of no browser bug which requires this kind of notation.

Same goes for XHTML unless you are serving it with the MIMEtype

application/xhtml+xml
- and in that case the uppercase CSS rules would still be redundant as the XHTML markup has to entirely in lower case.