::before

Content inserted with ::before is inserted before other content within the element and is displayed inline by default. The content value is specified using the content property.

Syntax


element::before { content: "text" }

Element - this can be (for example) - class, id and other selectors.

Content - it can be (for example) - a word, a link, a color, and other properties.

Visual presentation

added before <p class="your-class"> New content is added to CSSPortal. </p>

Examples

Add an icon before each item.


	
	 <h3>Seasons:</h3>
	 <q>Winter</q>
	 <q>Spring</q>
	 <q>Summer</q>
	 <q>Autumn</q>

	


	

	
		
	
q::before {
   content: "🌟";
} 



	
	  
	

Seasons:

Winter
Spring
Summer
Autumn