The content CSS property is used with the ::before and ::after pseudo-elements to generate content in an element. Objects inserted using the content property are anonymous replaced elements.
Code sample - headings and quotes
<p> We shall start this with a quote from Sir Tim Berners-Lee,
I was lucky enough to invent the Web at the time when the Internet already existed - and had for a decade and a half.</q> We must understand that there is nothing fundamentally wrong with building on the contributions of others.
<p> Here we shall quote the Mozilla Manifesto,
Individuals must have the ability to shape the Internet and their own experiences on the Internet.</q> And so, we can infer that contributing to the open web, can protect our own individual experiences on it.
/* use a class rather that an element selector to give more flexibility.
Below is a simple string example, but don't forget add a leading space
in the text string for spacing purposes */
content: " New!";
Code sample - rich link styling
<li><a id="moz" href="http://www.mozilla.org/">
Mozilla Home Page</a></li>
<li><a id="mdn" href="https://developer.mozilla.org/">
Mozilla Developer Network</a></li>
/* Keywords that cannot be combined with other values */
/* <string> value, non-latin characters must be encoded */
/* e.g. \00A0 for */
/* <uri> value */
/* <counter> values */
/* attr() value linked to the HTML attribute value */
content: attr(value string);
/* Language- and position-dependant keywords */
/* Except for normal and none, several values */
/* can be used simultaneously */
content: open-quote chapter_counter;
/* Global values */
The pseudo-element is not generated.
Computes to none for the :before and :after pseudo-elements.
<uri> or url()
The value is a URI that designates an external resource (such as an image). If the resource or image can't be displayed, it is either ignored or some placeholder shows up.
Counters may be specified with two different functions: 'counter()' or 'counters()'. The former has two forms: 'counter(name)' or 'counter(name, style)'. The generated text is the value of the innermost counter of the given name in scope at this pseudo-element; it is formatted in the indicated style ('decimal' by default). The latter function also has two forms: 'counters(name, string)' or 'counters(name, string, style)'. The generated text is the value of all counters with the given name in scope at this pseudo-element, from outermost to innermost separated by the specified string. The counters are rendered in the indicated style ('decimal' by default). See the section on automatic counters and numbering for more information. The name must not be 'none', 'inherit' or 'initial'. Such a name causes the declaration to be ignored.
Returns the value of the element's attribute X as a string. If there is no attribute X, an empty string is returned. The case-sensitivity of attribute names depends on the document language.
open-quote | close-quote
These values are replaced by the appropriate string from the quotes property.
no-open-quote | no-close-quote
Introduces no content, but increments (decrements) the level of nesting for quotes.
On elements, always computes to normal. On ::before and ::after, if normal is specified, computes to none. Otherwise, for URI values, the absolute URI; for attr() values, the resulting string; for other keywords, as specified.
the unique non-ambiguous order defined by the formal grammar