Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    May 2002
    Location
    Helsinki, Finland
    Posts
    231
    Thanks
    0
    Thanked 1 Time in 1 Post

    CSS definitions for XHTML elements

    This isn't truly a problem, more like a simple question where I couldn't find a proper answer.

    Because XHTML said to be case-sensitive and all the elements and attributes are needed to type lowercase, is this invalid css :
    Code:
    .
    <style type="text/css">
    BODY {background-color:#FFFFF8;color:#000000;}
    P {border:1px solid #C0C0C8;}
    </style>
    .
    .
    <body>
     <p>Foo, bar...</p>
    </body>
    .
    .
    In other words : is it mandatory to define css selectors in lowercase or are they valid also in uppercase?
    Zvona
    First Aid for
    Web Design

  • #2
    Regular Coder
    Join Date
    Nov 2002
    Location
    Bristol, UK
    Posts
    932
    Thanks
    0
    Thanked 0 Times in 0 Posts
    AFAIK you should use lowercase. At least, that's what my interpretation of the standards lead me to believe

    ::] krycek [::
    ithium | SOAPI | SDP | PTPScript manual
    "ithium is a non-profit webhost, which is pretty much unique. The mission of ithium is to provide free hosting resources for worthwhile and needy non-profit projects, which otherwise may not be able to obtain such facilities. The money from commercial customers goes to maintain ithium's servers and further development."

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts
    According to the CSS2 spec (http://www.w3.org/TR/CSS21/selector.html#q1):

    The case-sensitivity of document language element names in selectors depends on the document language. For example, in HTML, element names are case-insensitive, but in XML they are case-sensitive.

    So for XHTML, that would technically be invalid CSS. But some browsers may not care. For HTML, it shouldn't matter.

  • #4
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,453
    Thanks
    1
    Thanked 21 Times in 19 Posts
    More accurately, when you serve it as text/html, it shouldn't matter.
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #5
    New Coder
    Join Date
    Dec 2002
    Location
    Florida
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You'd -think- that the browser coders would add a line to transform everything to lowercase before applying css styles etc., But that would just be -too- difficult I guess.... (tongue in cheek)

    So, what do they do? Ahh yes they make -us- do all the work rather than making life easy for us! How silly of me to expect so much! LOL

    MrDoubtFire

  • #6
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Originally posted by MrDoubtFire
    You'd -think- that the browser coders would add a line to transform everything to lowercase before applying css styles etc., But that would just be -too- difficult I guess.... (tongue in cheek)

    So, what do they do? Ahh yes they make -us- do all the work rather than making life easy for us! How silly of me to expect so much! LOL

    MrDoubtFire
    Umm, did you read what Alex Vincent just wrote? XML is case-sensitive, therefore:

    <mytag> and <myTag> are very different elements. If a browser converted all element names to lower case, then it would be wrecking XML.

    And how is writing:

    div { }

    Anymore work than writing DIV {} ?

    I don't see your complaint, even if it was well-founded.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •