stoffer03 stoffer03 - 3 months ago 9
CSS Question

how to remove standard background color of text in a div

EDIT: Solved it. I had to change from the tag html to body { background. Thank you for your help everyone

I've searched on here and on google but I only get the opacity example, if I use opacity 0 then the text disappears too.

I have a html background meaning the complete page and in the code I've placed a div with a h1 and p tag with some text and then a white box-like background around the div of the text appears and I can't remove it.

<div class="container">
<div class="header-pris">
<h1>Pris alternativ:</h1>
<p>Skulle du vilja pröva enstaka timmar eller kanske tom mer timmar än vad som anges nedan så går det självklart också att annordna, kontakta oss direkt på
<a href="mailto:info@vanorden.se"> info@mail.se</a></p>
</div>
</div>

.header-pris {
text-align:center;
background-color:none;
}


tried with none as color but that doesn't do it so I don't know where I'm doing wrong or what the correct command should be to have no background on the div with the text so that you can see the image background

Answer

Text doesnt have a default background-color, it might be being set somewhere else in your CSS, use a property inspector in a browser to check which styles are applied

            body {
              background-image: url('http://www.pets4homes.co.uk/images/articles/1111/large/feline-influenza-all-about-cat-flu-5239fffd61ddf.jpg');
            }
            
            .header-pris,.header-pris-2 {
                text-align:center;
            }

            .header-pris-2 p {
                background-color: white;
            } 
<body>
  <div class="container">
    <div class="header-pris">
      <h1>Pris alternativ:</h1>
      <p>Skulle du vilja pröva enstaka timmar eller kanske tom mer timmar än vad som anges nedan så går det självklart också att annordna, kontakta oss direkt på 
        <a href="mailto:info@vanorden.se"> info@mail.se</a></p>
    </div>

    <div class="header-pris-2">
      <h1>Pris alternativ:</h1>
      <p>Skulle du vilja pröva enstaka timmar eller kanske tom mer timmar än vad som anges nedan så går det självklart också att annordna, kontakta oss direkt på 
        <a href="mailto:info@vanorden.se"> info@mail.se</a></p>
    </div>
  </div>

</body>