Home > Blockchain >  How to add header text using css
How to add header text using css

Time:07-25

I have the following html and this is part of the html in the header section of the site.

<body>
 <div id="headerMain" >
   <div >
     <div image.svg" >
     </div>
   </div>
   <h1></h1>
 </div>

I am trying to give the header content as "MySite" as like below using css

 #headerMain h1:before {
 content: MySite
}

But this is not getting updated. I am trying to find the solution and learn in the process.

CodePudding user response:

Try this,

 .header h1::before {
    content: "MySite";
 }

working example

CodePudding user response:

You must add quotes to attribute values on MySite. it works on me. The code is like below:

#headerMain h1:before {
  content : "Mysite";
}
<body>
 <div id="headerMain" >
   <div >
     <div image.svg" >
     </div>
   </div>
   <h1></h1>
</div>
  • Related