Made with ♡ by
- a magic word added to a selector that defines state of an element
- they detect if something changed
* in the content of an element
* mouse position
* history of navigator
.link:visited {
color: #bada55;
}
.link:hover {
transform: translateY(-5px);
}
.name-of-selector:name-of-pseudoclass {
/* what happens in pseudoclass, stays in pseudoclass */
border-color: #bada55;
}
.name-of-selector::before {
content: ":D";
}
:pseudoclass vs ::pseudoelement
- to avoid jQuery spaghetti
- they keep away IE users
.link:visited {
color: #bada55;
}
.link:hover {
transform: translateY(-5px);
}
stays in the same language => better code optimisation
less dependencies
more fun :D
browser support
mobile support
not its original purpose
applies styles when element is empty
element is empty when it does not have any children
HTML comments are not considered child elements
empty space is considered not empty
applies styles to an input when placeholder is shown
kind of detects if input is empty
vs.
:placeholder-shown && :not(:placeholder-shown)
applies styles when element is disabled
usually applied to form elements
applies styles when element is enabled
applies styles when type of an input element is valid
empty input is considered valid
applies styles when type of an input element is invalid
when used with :required, field will be invalid if it is empty
:valid, :invalid, :placeholder-shown
styles the element that is a target of a link
toggles checked state for the input type checkbox and radio buttons
👩💻
.question:not(:empty) {
display: block;
}