::after

W3C CSS Snapshot 2026

Insert decorative generated content at the end of an element’s content.

On this page

Syntax and values

Value or syntaxWhat it does
.notice::afterUses content to add a generated box after the element’s content.

Try the example

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>::after</title>
  <style>
.notice::after { content: " ◆"; color: teal; }
  </style>
</head>
<body>
<p class="notice">Registration opens Monday.</p>
<p id="location">Meet in Room 2.</p>
<h2>Workshop</h2>
</body>
</html>

What to expect A teal diamond appears after the notice text.

Official references