🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to CSS Notes
Topic #88

Content


Pseudo-elements for Content

Pseudo-elements for content allow you to insert content before or after elements, style list markers, and more.


The CSS ::before Pseudo-element

The ::before pseudo-element is used to insert some content before the content of a specified element.

Use the content property to specify the content to insert.

Example

h3::before
{

  content: url(smiley.gif);

}

The CSS ::after Pseudo-element

The ::after pseudo-element is used to insert some content after the content of a specified element.

Use the content property to specify the content to insert.

Example

h3::after
{

  content: url(smiley.gif);

}

The CSS ::marker Pseudo-element

The ::marker pseudo-element is used to style the list item markers.

Example

::marker {

  color: red;
  font-size: 23px;

}

The CSS ::selection Pseudo-element

The ::selection pseudo-element is used to style the part of a text that is selected by a user.

Example

::selection {
  color: red;

background: yellow;
}

The CSS ::backdrop Pseudo-element

The ::backdrop pseudo-element is used to style the viewbox behind a dialog box or popover element.

Example

  dialog::backdrop {
  background-color: lightgreen;
}

CSS Pseudo-elements Reference

Note: For a complete list of all CSS Pseudo-elements, visit our CSS Pseudo-elements Reference.

Want to go beyond the notes?

Join CodingNow 2.0's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Content – FAQs

Quick answers about learning Content in CSS.

This free note from CodingNow 2.0 explains Content in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on CodingNow 2.0, including Content, is 100% free with no signup required.
With focused practice, most students grasp Content in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now