Jason Turnbull wrote:
I was a bit unsure too as I thought the term 'selectors' in style sheets
referred too all tags, ids & classes,

Selectors are patterns that match against elements in a tree. They include the universal selector, type selectors, class selectors, ID selectors, attribute selectors, pseudo-classes and pseudo-elements

talking about uppercase tags in CSS (h1, p ect)

They are not "tags", they are *type selectors* which match an element based on its type (or tag name).

From what I tested and according the link Philippe posted uppercase
identifiers are ok

Yes and no. It is perfectly acceptable to write type selectors, ID selectors and class selectors, etc. in upper case; but whether or not they match anything in the document depends on the case sensitivity of the markup language.

Thus, all of the following are valid selectors:

P     /* Matches an element of type P */
.FOO  /* Matches an element whose class is "FOO" */
#BAR  /* Matches an element whose ID is "BAR" */

In an HTML document, tag names are case insensitive and so P will match either of the following; whereas in XHTML, tag names are case sensitive and so will only match the element with the upper case tag name:
  <p>
  <P>

However, all elements in XHTML are defined as lower case and so the uppercase <P> is an undefined element. Thus if a document included the uppercase tag-name, the document would be invalid but the uppercase type selector would still match it.

According to the HTML4 Recommendation and browser implementations (but, technically, not according to the rules specified by SGML and expressed in DTD) id attribute values are case sensitive and since XHTML is all case sensitive, #BAR will match:
  <p id="BAR">
but it will not match:
  <p id="bar">

Class attribute values are also case sensitive in both HTML and XHTML and so .FOO will match:
  <p class="FOO">
but it will not match:
  <p class="foo">

--
Lachlan Hunt
http://lachy.id.au/

******************************************************
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************


Reply via email to