asp.net.ph

Skip Navigation LinksAbakada: Back to Basics > Language References > CSS Properties > Pseudo-Classes > before Pseudo-class

::before Pseudo-class


Represents a child pseudo-element immediately before the originating element’s actual content.

Syntax

selector::before { content: value;
   property: value; }

Possible Values

property Any valid CSS property.
value Any of the range of values available to the corresponding property.

Remarks

The ::before pseudo-class generates a pseudo-element that is the first child of the selected element.

It is often used to add custom content to an element via the content property, such as icons, tooltips, or other cosmetic decoration.

The syntax for using the ::before pseudo-class is straightforward. A selector immediately precedes the pseudo-class.

For example, to add content before the selected element:

.warning::before { content: url( "/shared/images/exclaim.gif" ) }

Example

The following demonstrates use of the ::before pseudo-class in an embedded stylesheet to add content before an element.

External References

See Also

::after



Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note