CSS ::after Selector

What is CSS ::after Selector?

CSS ::after element selector add the content to the end of parent element.
Added new content will inherited of parent properties.

Syntax

General syntax of ::after selector,

/* CSS2 syntax */
element:after {
  property: value;
  property: value;
  ...
}

/* CSS3 syntax */
element::after {
  property: value;
  property: value;
  ...
}

Example

CSS :after selector add the content to the end of parent element.

<!DOCTYPE html>
<html>
<head>
  <title>CSS ::after Selector</title>
  <style>
    p.image::after{
      content: " - After word";
      color: #FF0000;
    }
  </style>
</head>
<body>
  <p class="image">This example for ::after pseudo element</p>
</body>
</html>

Run it...   »

Browser Compatibility

  • Google Chrome 2+
  • Mozilla Firefox 3.5+
  • Internet Explorer 9+
  • Opera 9.5+
  • Safari 1.3+

Note: Here details of browser compatibility with version number may be this is bug and not supported. But recommended to always use latest Web browser.