The best thing about Cascading Style Sheets is that they are amazingly simple to set up. They don’t require plug-ins or fancy softwarejust text files with rules. A CSS rule specifies the HTML to which a style definition applies, and then defines the style, or how the selected HTML should behave in the browser window.
You can set up rules to tell a specific HTML tag how to display its content, or you can create generic rules and then apply them to tags at your discretion.
The three most common selectors, or ways to select the HTML to which a style applies, are:
All CSS rules consist of a selector and a declaration block. The declaration block, which is surrounded by curly braces, is made up of declarations, which are pairs of properties and values separated by a semicolon (;):
Tags or Selectors: What’s the Big Difference?
An HTML element name is the text part of an HTML tagthe part that tells the browser what type of tag it is. So when you define an HTML selector in CSS using the element name, you are, in fact, redefining the HTML tag. Although the two components, tag and selector, seem to be identical, they aren’t: If you used the full HTML tagbrackets and allin a CSS rule, the tag would not work. So it’s important to keep these two ideas separate.
Uppercase or Lowercase Tags?
HTML tags are not case-sensitive. That is, the browser does not care whether the element and attribute names (the text) in the tags are uppercase or lowercase. Most people prefer to use uppercase for tags, because this makes them stand out from the surrounding content.
I counted myself in that camp until the release of the XHTML standard. One important characteristic of XHTML is that it is case-sensitive, and all element and attribute names must be in lowercase. Therefore, to prepare for the next evolutionary step of HTML, I have started using lowercase selectors in all my HTML tags.
For more about the CSS Selectors, check out http://www.w3.org/TR/REC-CSS2/selector.html
Quotation from “Visual Quickstart Guide CSS, DHTML, and Ajax, Fourth Edition Book”
Tags: coding reles, Selector