Skip to content
Related Articles

Related Articles

Improve Article

CSS | ::before selector

  • Last Updated : 07 May, 2021

::before selector is used to add the same content multiple times before the content of other elements. This selector is same as ::after selector.


Below HTML/CSS code shows the functionality of ::before selector : 


<!DOCTYPE html>
        p::before {
            content: " - Remember this";
            background-color: blue;
    <h3>Before Selector</h3>
<p>User ID: @dmor1</p>
<p>Name: dharam</p>


Supported Browsers 

  • Google Chrome 4.0
  • Edge 9.0
  • Firefox 3.5
  • Safari 3.1 
  • Opera 7.0

Note: Internet Explorer 8 and Opera 4-6 supports with single-colon.(::before)


My Personal Notes arrow_drop_up
Recommended Articles
Page :