CSS3 Selectors and Pseudo-Classes: Appendix D - CSS Cookbook, Third EditionChristopher Schmitt
4、伪类选择器(Pseudo-classes): 利用伪类选择器可以标识某些元素不同状态的不同样式,例如a元素: /*makes all unvisited links blue*/a:link{color:blue;}/*makes all visited links green*/a:visited{color:green;}/*makes links red when hovered or activated. focus is added for keyboard support*/a:h...
It is probably better in terms of ergonomics to have two pseudo-classes for the two states, e.g.: :has-dropdown and :no-dropdown :select-has-dropdown and :select-no-dropdown :select-with-dropdown and :select-without-dropdown Since it will only match select elements it seems reasonable...
selectors and pseudo classes in particular cannot depend on layout, because otherwise they could be used to modify layout in a way that made them no longer match, which would modify the layout back to where it was, so they match again, and we get stuck in an infinite loop of contradiction...
Selectors and Pseudos Share:DiggDel.icio.usRedditFacebookTwitterDiigo
伪类选择符 Pseudo-Classes Selectors 选择符版本描述 E:link CSS1 设置超链接a在未被访问前的样式。 E:visited CSS1 设置超链接a在其链接地址已被访问过时的样式。 E:hover CSS1/2 设置元素在其鼠标悬停时的样式。 E:active CSS1/2 设置元素在被用户激活(在鼠标点击与释放之间发生的事件)时的样式。 E:focus...
Pseudo-Classes and Pseudo-Elements :link 3 :visited 3 :hover† 4 :active†† 4 ::first-letter 5.5 ::first-line 5.5 :first-child 7 ::after 8 ::before 8 :focus 8 :lang(C) 8 :checked 9 @page :first, @page :left, @page :right 9 :root 9 :nth-child(n), :nth-last-chi...
Pseudos are comprised of two types: pseudo-classes that select elements in a particular "state" and pseudo-elements that are extra elements on the page that we can select even though they are not in the HTML.
Style rules are usually attached to an element based on its position in the document structure; however, CSS uses the concepts ofpseudo-classesandpseudo-elementsto permit formatting based on information that lies outside the document tree. Pseudo-elements are used to address subparts of elements (...
A single selector can contain any number of :is() pseudo-classes. For example, the complex selector below applies the green text color to all , and elements which are , which contains the class .primary or .secondary and is not the first child of . article section:not(:first...