Advanced Selectors Flashcards
[att^=”val”]
“begins with” selector
[att$=”val”]
“ends with” selector
[att*=”val”]
“contains” selector
:nth-child(an+b)
:nth-child(even)
:nth-child(-n+4)
:nth-last-child(n+3)
- targets the even list items only
- targets the first 4 list items only
- targets the last 3 list items only
:root
- selects the element that is the root of the document.
- this will usually be the HTML element because it is the root of our document
- more specificity than the HTML type selector
:target
- targets an element only if its ID matches the hash in a URL
- fragment identifiers
:empty
targets elements that have no child elements or content whatsoever
:not()
negation pseudo-class that selects everything except the element we specify, and we can use it with just about any type of selector
:enabled
selects UI elements that are in an enabled state
:disabled
selects UI elements like buttons and form inputs that are in a disabled state
:checked
selects UI elements that are in a checked state, such as a text box or a radio button
::first-line
selects the first line of text rendered by the browser
::first-letter
selects the very first character, or letter, of the first line of text
::before and ::after
- inserts generated content into a page
- they both work the same way, except that one inserts the content before the element and the other inserts the content after
- for these pseudo-elements to work properly, we must use the content property
- at the very least the content property must contain an empty set of quotes as its value
How is generated content rendered in the browser?
it appears as child content before or after an element’s content