CSS: Insert Content Before or After Element

By Xah Lee. Date: . Last updated: .

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 ";
}

CSS, Text Decoration