HTML and CSS Reference
In-Depth Information
The final example matches any <div> tag whose lang attribute is set
to a hyphen-separated list of words, beginning with "en." This example
matches attributes such as lang=en, lang=en-us , and lang=en-uk .
You may combine the universal selector with attribute selectors to
match any element with a specific attribute. For example:
*[class=comment] { display: none }
would hide all the elements in your document whose class attributes are
set to comment .
Netscape, Firefox, Opera, and other modern browsers support attribute
selectors; for unknown reasons, Internet Explorer does not.
8.2.6. Pseudoelements
Some elemental relationships in your documents you cannot explicitly
tag. The drop-cap is a common print style, but how do you select the
first letter in a paragraph? There are ways, but you have to identify each
instance separately. There is no tag for the first line in a paragraph. And
sometimes you might want the browser to automatically generate con-
tent, such as to add the prefix "Item #" and automatically number each
item in an ordered list.
CSS2 introduces four new pseudoelements that let you define special re-
lationships and styles for their display ( :first-line, :first-letter, :be-
fore , and :after ). Declare each as a colon-separated suffix of a standard
markup element. For example:
p:first-line {font-size: 200%; font-style: italic}
means that the browser should display the first line of each paragraph
italicized and twice as large as the rest of the text. Similarly:
Search WWH ::

Custom Search