Pseudo-elements
A pseudo-element uses two colons. ::first-line and ::first-letter style part of the text, ::selection styles highlighted text, and ::before and ::after insert generated content.
::before and ::after need a content property to appear. Use them for decoration only, not for important information.
Example
<style>
p::first-letter { font-size: 2.4em; color: darkred; }
.tag::before { content: "#"; color: gray; }
.tag::after { content: " (new)"; color: seagreen; }
</style>
<p>Dropped initial letter.</p>
<p class="tag">css</p>Exercise
Add generated content before each link.
a:: { content: "> "; }
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.