Syntax | selector {content: value value;}
(OR)
selector {content: value;}
|
---|---|
Usage | The content property, used with the :before and :after pseudo elements, allows additional content to be generated. For example, this property could be used to generate paragraph numbers at the beginning of all <p> tags. This property is specified by using one or more of the following values according to the syntax shown above:
CSS Example: The content properties are set using string values. p:before {content: "Start - "; color: red; } p:after {content: " - End"; color: red; } CSS Example: The content property is set using a URI that is pointing to an image. p:before {content: url("../images/dots.gif");} CSS Example: The content property is set using a counter value followed by a string value. p:before {content: counter(tst1, upper-roman) ". ";}
p {counter-increment: tst1;} CSS Example: The content property is set using an attr(attribute-identifier) value. a:after {content: attr(href);
color: red} |
Keywords |
|
Applies To | The pseudo elements :before and :after. |
Inherited | No |
Initial Value | normal |
The content properties are set using string values. The content property is set using a URI that is pointing to an image. The content property is set using a counter value followed by a string value. The content property is set using an attr(attribute-identifier) value. |