Building Your Learning Module...
Getting things ready for you!
Find videos you like?
Save to resource drawer for future reference!
::Select elements in certain states
button:hoverStyle specific parts of elements
p::first-letterInsert content before element
p::before { content: "→ "; }Insert content after element
a::after { content: " →"; }Style first letter of text
p::first-letter { font-size: 2em; }Style first line of text
p::first-line { font-weight: bold; }<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<div class="container">
<h1>✨ Pseudo-Elements</h1>
<div class="label">::first-letter (Drop Cap)</div>
<p class="drop-cap">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Notice how the first letter is much larger and styled differently.
This is called a drop cap and is commonly used in magazines and books.
</p>
<div class="label">::first-line (Bold First Line)</div>
<p class="intro">
This entire first line is bold and larger.
The rest of the paragraph continues with normal styling.
This is great for introductions and article openings.
</p>
<div class="label">::before & ::after (Quotation Marks)</div>
<div class="quote">
CSS pseudo-elements are powerful tools that let you add style and
content without cluttering your HTML. Master them for cleaner code!
</div>
<div class="label">::after (Animated Arrow)</div>
<p>
<a href="#" class="fancy-link">Hover over this link</a> to see the arrow animation!
</p>
</div>
</body>
</html>Loading preview...
The content property is required for ::before and ::after pseudo-elements.
content: "text";Insert textcontent: "";Empty (for decorative shapes)content: attr(href);Use attribute valuecontent: url(icon.png);Insert imagecontent property