CSS Basic
CSS Styling
CSS Box Model
CSS Advanced
| CSS Pseudo-class |
|
CSS pseudo-classes are used to add special effects to some selectors. SyntaxThe syntax of pseudo-classes:
CSS classes can also be used with pseudo-classes:
Anchor Pseudo-classesLinks can be displayed in different ways in a CSS-supporting browser:
Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!! Note: a:active MUST come after a:hover in the CSS definition in order to be effective!! Note: Pseudo-class names are not case-sensitive. Pseudo-classes and CSS ClassesPseudo-classes can be combined with CSS classes:
If the link in the example above has been visited, it will be displayed in red. CSS - The :first-child Pseudo-classThe :first-child pseudo-class matches a specified element that is the first child of another element. Note: For :first-child to work in IE a <!DOCTYPE> must be declared. Match the first <p> elementIn the following example, the selector matches any <p> element that is the first child of any element:
Match the first <i> element in all <p> elementsIn the following example, the selector matches the first <i> element in all <p> elements:
Match all <i> elements in all first child <p> elementsIn the following example, the selector matches all <i> elements in <p> elements that are the first child of another element:
CSS - The :lang Pseudo-classThe :lang pseudo-class allows you to define special rules for different languages. Note: Internet Explorer 8 (and higher) supports the :lang pseudo-class if a <!DOCTYPE> is specified. In the example below, the :lang class defines the quotation marks for q elements with lang="no":
Add different styles to hyperlinks Use of :focus Pseudo-classesThe "CSS" column indicates in which CSS version the property is defined (CSS1 or CSS2).
|
CSS Pseudo-class