CSS: Insert Content Before or After Element
- Use
::before
to insert content before a HTML element - Use
::after
to insert content after a HTML element
they are CSS: Pseudo Element
Example
How to do this?
The “Q” is not in HTML. It is added by CSS.
Code
<p class="mkfkj">How to do this?</p>
.mkfkj::before { color: red; font-family: serif; font-size: 3rem; content: "Q "; }