0

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

<body>
 <div id="headerMain" class="header flex-row start-xs">
   <div class="flex-col-xs-nofill">
     <div class="headerlogo> 
        <img src="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.

2
  • 3
    Just wanted to give a heads-up that search engines won't pickup on the text inside the <h1> which isn't a problem inside application but if this is a marketing website, this can lead to a lower ranking on for example Google. Commented Jul 25, 2022 at 10:33
  • use quotes for text Commented Jul 25, 2022 at 11:10

2 Answers 2

3

Try this,

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

working example

Sign up to request clarification or add additional context in comments.

Comments

1

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" class="header flex-row start-xs">
   <div class="flex-col-xs-nofill">
     <div class="headerlogo> 
        <img src="image.svg" >
     </div>
   </div>
   <h1></h1>
</div>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.