border-radius
or box-shadow
specification belongs to if you know how to use them correctly. A similar situation with new selectors is just another (next) version of the “Selector” specification. ul.menu li a:link, ul.menu li a:hover, ul.menu li a:visited, ul.menu li a:focus { color: red; }
ul.menu li a:matches(:link, :hover, :visited, :focus) { color: red; }
article:matches(.active, .visible, #important) { background: red; }
p:not(.active, .visible) { color: red; }
.active
or. visible
.a:link
and a:visited
into one so that you don’t have to write: a:link, a:visited { color: red; }
a:any-link { color: red; }
:local-link
is more interesting. They can, for example, give your style a link pointing to your personal page, leaving all other links intact: nav :local-link { text-decoration: none; }
:not(:local-link(0)) { color: red; }
:local-link
used with the parameter. The number in parentheses defines the part in the URL of the path by which each matching link will be matched. nav :local-link(0) { color: red; } nav :local-link(1) { color: green; } nav :local-link(2) { color: blue; } nav :local-link(3) { color: yellow; } nav :local-link(4) { color: gray; }
end3r.com/2012/10/20/some-title
end3r.com/2012/10/20/some-title
, and you have the following links in the menu: p:current { background: yellow; }
:enabled
:disabled
or :checked
, there is one new :indeterminate
. As everyone knows, flags and switches can have two states: set and not set. Each state can be defined by pseudo-classes: checked - for set and: not (: checked) - for not set. But what if you want to issue an item that has not yet been used. In fact, neither the set state nor the set state can be determined. In some cases, this is useful, for example, to remind the user that he missed something. Thus, we can stylize elements that have not yet been used and do not have a default state: input.checkbox:indeterminate { background: #ccc; }
progress:indeterminate { background: #ccc; }
:nth-match
, you can achieve much greater opportunities than ever before. Curious how it works? Okay, imagine that I take the pseudo-class nth-child, which selects the elements and combines it with the power of the pseudo-class :matches
, and you will get an answer to your question.nth-child(even)
to select even-numbered elements, but this is not enough, because we need links with the class .active. Does not fit also :matches(.active)
, since in this case, we generally select all links with the class .active. In this case, it will help us :nth-match
: li a:nth-match(even of .active) { color: red; }
p:nth-match(2n+1 of .active, .visible, #important) { color: red; }
:nth-last-match
works the same way as: nth-match, but starts searching from the end of the DOM tree. :column(.total) { background: red; } :nth-column(even) { background: blue; }
ul li! a.active { color: red; }
body! header a.styleSwitcher:hover { background: red; }
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
( - ) .styleSwitcher, . , , JS . , CSS – .
: ( 29 2011) , ($li). ( 22 2012) , , (li!). , . , , . , , , .
, jQuery cssParentSelector .
:
, ? , . . , , . , , CSS , JS .
, «4- » . , , . , . : . , , .
, , . , , , .
, , , Sel – , . , , .
«4 »
:
CSS4 Media Queries CSS4 Background CSS4 Images CSS4 Text
, , , , – W3C. , , , .
:
, , : W3C « 4 ». , . David Storey - W3C.
?
, , – , . ? , CSS, - ? : , , , , , . , !
Source: https://habr.com/ru/post/167333/
All Articles