Reputation: 96544
Our sites use markup like this in a few places:
<header class="row">
::before
<h1 class="entry-title">Privacy Policy</h1>
::after
</header>
What does the ::before
and ::after
signify and how could I use them?
Upvotes: 0
Views: 969
Reputation: 311
The ::before
element inserts an html element before the given element, just as the ::after
element inserts an html element after the given element. (as described here, try-it-yourself)
For example:
index.html
<html>
<head>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<p>World</p>
</body>
</html>
style.css
p::before {
content: "Hello ";
}
p::after {
content: "!";
}
This will result in Hello World!
on your HTML page.
Upvotes: 1
Reputation: 943999
You should not see those in markup.
You may see them in the element inspector in various browsers developer tools.
They represent the before and after pseudo-elements that you can generate with CSS.
Upvotes: 5