CSS :after Selector

Complete CSS Reference Complete CSS Reference

Example

How to insert content after all <p> elements:

p:after
{
content:"- Remeber this";
}

Try it yourself »

Definition and Usage

The :after selector inserts content after the selected element(s).

Use the CSS content property to specify the content.

Read more about the content property in our content property reference.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The :after selector is supported in all major browsers.

Note: For :after to work in IE, a <!DOCTYPE> must be declared.


CSS Version

The :after selector was first introduced in:

CSS 2


Related Pages

CSS tutorial: CSS Pseudo-elements

CSS Selector Reference: CSS :before selector


Examples

Try it Yourself - Examples


Example

Style the inserted content:

p:after
{
content:"- Remember this";
background-color:yellow;
color:red;
font-weight:bold;
}

Try it yourself »

Complete CSS Reference Complete CSS Reference