Open In App

CSS ::after Selector

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

::after selector is used to add same content multiple times after the content of other elements. This selector is same as ::before selector. 

Syntax:

::after{
        content:
}

Below HTMl/CSS code shows the functionality of ::after selector : 

HTML




<!DOCTYPE html>
<html>
  
<head>
    <style>
        p::after {
            content: " - Remember this";
            background-color: blue;
        }
    </style>
</head>
  
<body>
    <h3>After Selector</h3>
    <p>User ID: @dmor1</p>
    <p>Name: dharam</p>
</body>
  
</html>


Output:

  

Supported Browsers

  • Google Chrome 1.0
  • Edge 12.0
  • Firefox 1.5
  • Safari 4.0
  • Opera 7.0

Note: Opera 4-6 supports with single-colon.(:after)


Last Updated : 07 Jun, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads