::after - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:after

Description

The ::after selector selects content after the content of each selected element.

You can use the content property to set the content to insert.

You can Use the ::before selector to add something before the content.

Example

The following code shows how to insert content after every <p> element, and style the inserted content.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
p::after {<!--   w  w  w. j a va2s. co  m-->
    content: " - added content";
    background-color: yellow;
    color: red;
    font-weight: bold;
}
</style>
</head>
<body>

<p>this is a test</p>
<p>this is another test</p>

</body>
</html>

Related Tutorials