Web4College

CSS content property

src

Description

CSS content property content inside an element or pseudo elements (::after, ::before, ::marker). The content might be a string or url of an image.

Syntax

content : normal | none | url(image-address) | string | open-quote | close-quote

Property values

normalDefault

It computes to contents for an element. And it computes to inhibit for a pseudo element.

content: normal;
Try it

none

It does not add any content.

content: none;
Try it

string

It adds a string in pseudo elements (::before or ::after).

In the following demo, we add a string in the pseudo (::before) element.

content: "Note: "; 
Try it

url(image-address)

It can add an image either as the content of pseudo elements or normal element.

In the following demo, we add an image in the ::before pseudo element.

content: url("img/web4college.png");
Try it

open-quote

In the following demo, we add an open-quote in the ::before pseudo element.

content: open-quote;
Try it

close-quote

In the following demo, we add a close-quote in the ::after pseudo element and open-quote in the ::before pseudo element.

content: close-quote;
Try it

Applicable to

It applies to ::before, ::after and ::markers only. But image and url values can apply to all elements..