1
I’m trying to make a background for the body
using an image and a linear-gradient
, on loading the gradient appears for an instant, but is soon replaced only by the image, as you can see below.
body {
background: url("https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/Lake_O_Hara_from_Yukness_Ledge_Alpine_Route.jpg/800px-Lake_O_Hara_from_Yukness_Ledge_Alpine_Route.jpg"),
linear-gradient(to left, rgb(0,180,0), rgb(0,180,180));
background-size: cover;
}
<!DOCTYPE html>
<html>
<body>
</body>
</html>
Why does this happen?
It worked, thank you very much, but now another question has arisen because of
rgba
, I saw in an example like this,body {
 background: url('imagens/capa.png'),
 url('imagens/ruido.png'),
 linear-gradient(50deg,#ff4169,#7c26f8);
 background-attachment: fixed;
 overflow-x: hidden;
}
, this overlap is done with the overflow? Because the colors of thelinear-gradient
are hexadecimal, and the gradient is below theurl
of the image.– Dobrychtop
That must be because of the images. PNG tb accept Alpha Channel, which means you can put transparency in them in the Photoshop image editor, then export the . Translucent PNG, it can only be that, or else the element is all transparent. Only evaluating the model to be sure. On the overflow he does not serve to create transparency, he serves to "hide" what is coming out of Div, like if the content of the Son is coming out of the Father you put overflow in the Father to hide the content of the Son who is out understands.
– hugocsl
Wow, that’s exactly it, I was trying to fix everything in
CSS
, I had done withrgba
, but the image.jpg
was on top, so I hid the gradient in the same way, thank you very much @hugocsl for the excellent explanation!– Dobrychtop
That’s right, Tmj [] s
– hugocsl