3
I’m breaking my head with a simple thing, usually I solve these problems by looking at google, but today I did not have this luck.
And the following, I want to create a background with the class "Linear Animation Infinite", but I want to put a PNG image on top with the same done, moving the image along with the background color.
I could not in any way superimpose the image over the background color.
Note: I tried to use z-index but was not successful.
.imagem {
width: 500px;
height: 500px;
background: url("https://i.imgur.com/XhYIPUs.png") repeat left top;
-webkit-animation: 40s linear infinite LoadingBarProgress, .5s ease-out LoadingBarEnter;
animation: 40s linear infinite LoadingBarProgress, .5s ease-out LoadingBarEnter;
-webkit-transform-origin: left;
transform-origin: left;
}
.cor-de-fundo {
width: 500px;
height: 500px;
background: #a8a8a8 linear-gradient(to right, #a8a8a8, #3d3d3d, #ffafa9, #3d3d3d, #a8a8a8);
background-size: 500%;
-webkit-animation: 40s linear infinite LoadingBarProgress, .5s ease-out LoadingBarEnter;
animation: 40s linear infinite LoadingBarProgress, .5s ease-out LoadingBarEnter;
-webkit-transform-origin: left;
transform-origin: left;
}
@-webkit-keyframes LoadingBarProgress {
0% {
background-position: 0% 0
}
to {
background-position: 125% 0
}
}
@keyframes LoadingBarProgress {
0% {
background-position: 0% 0
}
to {
background-position: 125% 0
}
}
@-webkit-keyframes LoadingBarEnter {
0% {
-webkit-transform: scaleX(0);
transform: scaleX(0)
}
to {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
}
@keyframes LoadingBarEnter {
0% {
-webkit-transform: scaleX(0);
transform: scaleX(0)
}
to {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div class="imagem cor-de-fundo"></div>
</body>
</html>
Wouldn’t it be the case if you used another
<div>
?– Leandro Angelo
work, however would have to use position, and affect the page in full :(
– Vitor Hugo