Made with ♡ by
CSS3 distinguishes pseudoelements and pseudoclasses
::double-colon for pseudoelements
:single colon for pseudoclasses
.link:hover {
/* pseudoclass */
background-color: #bada55;
}
.link::after {
/* pseudoelement */
content: "*_*";
}
a magic keyword added to a selector
a virtual element that is not really in the DOM
accessibility problem
one element can only have one pseudoelement
they style some part of the selected element
they inject virtual element to the DOM
we can do lots of tricks with them
.header::before {
content: "Before the header";
font-size: 2rem;
}
.header::after {
content: "After the header";
font-size: 2rem;
}
.title::first-character {
color: #292929;
font-size: 3rem;
}
.title::first-line {
background-color: blue;
}
First line example (responsive):
First line with different display values
First letter:
First letter and display property
Example: https://codepen.io/tonkec/pen/EBvXOR
pseudoelements are playing hard to get
CSS shapes: https://css-tricks.com/the-shapes-of-css/
border on body: https://codepen.io/tonkec/full/wLpVML
pure CSS multistep form with validation: https://codepen.io/tonkec/full/zbPQqJ
css timeline: https://codepen.io/NilsWe/pen/FemfK
pure css font: https://yusugomori.com/projects/css-sans/fonts
add font family: https://codepen.io/mburnette/pen/rdGJc
custom list bullets: https://codepen.io/davidhund/pen/JozyLm
.meetup::after {
content: "beer";
}