Learn practical uses for over 25 pseudo-classes and pseudo-elements with Mike Kivikoski. Starting with the basics, you’ll quickly advance to use cases that apply to positioning, text, content, and get a glimpse at some (hopeful) future selectors. All levels of CSS experience are welcome and encouraged to attend - there is something for everyone!
Codepen collection of examples bit.ly/pseudo-pen
15. :lang(language)
Styles applied with match of elements based on the
document language.
:lang(language){
property: value;
}
selector:lang(language){
property: value;
}
52. :invalid
Styles applied to form elements with a value that doesn’t
validate according to the element's settings.
selector:invalid{
property: value;
}
61. :indeterminate
Styles applied to a checkbox with a javascript based
indeterminate state or an empty progress bar.
selector:indeterminate{
property: value;
}
63. :in-range
Styles applied to input elements when their value is
inside the range specified as being acceptable.
selector:in-range{
property: value;
}
66. :out-of-range
Styles applied to input elements when their value is
outside the range specified as being acceptable.
selector:out-of—range{
property: value;
}
106. :nth-last-child(n)
Styles applied to selector(s) based on their source order
starting from the bottom of the source order.
selector:nth-last-child(n){
property: value;
}
111. :nth-of-type(n)
Styles applied to selector(s) based on their source order
and element type.
selector:nth-of—type(n){
property: value;
}
112. :nth-last-of-type(n)
Styles applied to selector(s) based on their source order
and element type, starting with bottom of source order.
selector:nth-last-of—type(n){
property: value;
}
113. :target
Styles applied to the active element that is targeted with a
fragment identifier in the URL.
selector:target{
property: value;
}
124. :has(s1)
The relational pseudo-class represents elements whose
relative scope selector match when evaluated absolute.
selector:has(s1){
property: value;
}
http://css4-selectors.com/selector/css4/relational-pseudo-class/
128. :matches(s1, s2)
Takes as an argument a selector list to create sets of
selectors by instituting groups which match all
included selectors.
selector:matches(s1, s2){
property: value;
}
http://css4-selectors.com/selector/css4/matches-any-pseudo-class/
129. :matches(s1, s2)
:matches(section, article, aside) h1 {
color: red;
}
// is the same as
section h1, article h1, aside h1 {
color: red;
}
http://css4-selectors.com/selector/css4/matches-any-pseudo-class/
130. :local-link
Styles website-internal links with ability to style specific
depths of links.
:local-link,
:local-link(n){
property: value;
}
http://css4-selectors.com/selector/css4/local-link-pseudo-class/