Get my e-book focusing on CSS3 and
modern web UI development.
dig into web UI development
Last modified: 12. 3. 2016
CSS3 marches in with an army of new selectors. Let’s look at it through the lens of Internet Explorer. Depending on what version of IE you have to support, you can use the following selectors:
attrattribute value that starts with a “val” string. Is is widely used by CSS frameworks for making grids. Classes such as
.span2etc. are targeted like this:
attrattribute value that ends with a “val” string.
attrattribute value that contains a “val” string.
p ~ ul– unlike
p + ul, both selectors have the same parent but are non-adjacent.
span:empty– targets all
<span>elements that have no child elements or text.
div:target– targets the link anchor (
input:disabled– targets a form field that is read-only.
input:checked– targets an active input type
*::selection– styling of selected text.
span:not(.blue)– targets all spans except the ones with the
:only-child– target the first, last or only child of a parent.
:nth-last-child(n)– target an n-th child from the start or end. You can master this crazy (yet very useful) selector using this online tool: NthMaster.
:only-of-type– target the first, last or only one of a type element.