What Is The ::before Or ::after Expression, And Why Is It Shown In The Browser Developer Tools?
I have read ::before is used to add content before the element you use it with, e.g. p::before { content: 'Read this: '; } but most of the times I have seen (peeking at web p
Solution 1:
CSS-Tricks:
CSS has a property called content. It can only be used with the pseudo elements :after and :before. It is written like a pseudo selector (with the colon), but it's called a pseudo element because it's not actually selecting anything that exists on the page but adding something new to the page.
::before insert content before an element using css.
q::before {
content: "«";
color: blue;
}
::after insert content after an element.
q::after {
content: "»";
color: red;
}
you can use Special Characters too, some of them:
\2018 - Left Single Smart Quote
\2019 - Right Single Smart Quote
\00A9 - Copyright
\2713 - Checkmark
\2192 - Right arrow
\2190 - Left arrow
you can use element attributes too:
<a title="A web design community." href="http://css-tricks.com">CSS-Tricks</a>
a:before {
content: attr(title) ": ";
}
read complete article here
Post a Comment for "What Is The ::before Or ::after Expression, And Why Is It Shown In The Browser Developer Tools?"