2
I want to make the background image transparent without affecting the other items of the body, only the image, but when I put the opacity the whole site becomes transparent, if in case there is no good practice I use the tag img as background image?
This is the html:
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>Formularios</title>
    <link rel="stylesheet" href="formularioscss/formularios.css" type="text/css"/>
</head>
<body>
  <header class="cabecalho">
      <!-- <img src="imagens/faculdade_impacta_azul.jpg" alt=""> -->
        <ul>
            <li><a href=""> Home</a></li>
            <li>Lista de Cursos</li>
            <li>Noticias</li>
        </ul>
    </header>
    <div class="tran">
      <!--<img src="D:/Apache24/htdocs/TecWeb/EP_TecWeb/Formularios/Imagens/Fundo_Login.png" alt="">-->
    </div>
    <form method="GET" action="" class="formLogin">
        <label for="Login">Login</label>
        <p><input type="login" name="login" id="login"></p>
        <label for="senha">senha</label>
         <p><input type="password" name="senha" id="senha"></p>
    </form>
</body>
This is the css section that I want to make the background image transparent:
body {
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.4)),
   url("D:/Apache24/htdocs/TecWeb/EP_TecWeb/Formularios/Imagens/Fundo_Login.png");
    background-attachment: fixed;
    background-size: 100%;
    background-repeat: no-repeat;
    font-family: 'PT Sans', sans-serif;
}
Thanks worked out here, but now another problem has arisen, I’m using a horizontal menu in the upper part, and with the opacity the background image is superimposing the menu, as I arrange it?
– zaque
@That’s because of the stacking level. That’s why I added that second option to create a wrapper and assign a z-index that way. Add a
z-indexof0or negative to the element.bg-fundo. For example:.bg-fundo{z-index:-1;}. If it doesn’t work, follow the instructions of the second method I indicated in my reply. To learn more about z-index visit this link or this answer in which I detailed a little about what z-index is in Portuguese.– Chun
Oops, now that I put -1 worked out, but once thanks
– zaque