I am trying to apply a animated gradient to my header class. For some reason I am not able to get this to work.
I'm trying to do this but not to the body, just the header. https://www.gradient-animator.com/
What's going on here? Can anyone help point me in the right direction?
The HTML, CSS
.business-header {
background: linear-gradient(50deg, #282466, #ffc500);
height: 400px;
-webkit-animation: test 2s ease infinite;
animation: test 2s ease infinite;
}
#-webkit-keyframes test {
0%{background-position:51% 0%}
50%{background-position:20% 100%}
100%{background-position:51% 0%}
}
#-moz-keyframes test {
0%{background-position:51% 0%}
50%{background-position:50% 100%}
100%{background-position:51% 0%}
}
#keyframes test {
0%{background-position:51% 0%}
50%{background-position:50% 100%}
100%{background-position:51% 0%}
}
<header class="business-header">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1 class="tagline"></h1>
</div>
</div>
</div>
</header>
Working Fiddle
.business-header {
background: linear-gradient(270deg, #a4ffe8, #092f25);
background-size: 400% 400%;
-webkit-animation: AnimationName 30s ease infinite;
-moz-animation: AnimationName 30s ease infinite;
animation: AnimationName 30s ease infinite;
min-height: 100%;
min-width: 100%;
height:400px;
}
You did not mention the background size.. that was the problem
Related
I have a background made with 3 separate images i want to add rotate animation to all 3 images. If i animate the number-bg class all 3 images rotates. I want the rotate speed to be different for each image. what is the best approach to do that.
mycode
<style>
body {
height: 100%;
}
.number-bg {
height: 1000px;
background-image: url(https://i.imgur.com/BZrswvf.png),
url(https://i.imgur.com/XJ9zZeA.png),
url(https://i.imgur.com/RJDk9uS.png);
background-repeat: no-repeat;
background-position: center;
}
</style>
<body>
<div class="number-bg">
</div>
</body>
Image:
Check out the code to rotate each image at different speeds.
.number{height: 1000px;
background-repeat: no-repeat;
background-position: center;}
.no-9 {
background-image: url(https://i.imgur.com/BZrswvf.png);
-webkit-animation:spin 3s linear infinite;
-moz-animation:spin 3s linear infinite;
animation:spin 3s linear infinite
}
.no-6 {
background-image: url(https://i.imgur.com/XJ9zZeA.png);
-webkit-animation:spin 6s linear infinite;
-moz-animation:spin 6s linear infinite;
animation:spin 6s linear infinite
}
.no-3 {
background-image: url(https://i.imgur.com/RJDk9uS.png);
-webkit-animation:spin 1s linear infinite;
-moz-animation:spin 1s linear infinite;
animation:spin 1s linear infinite
}
#-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
#-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
#keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); }
<div class="number no-9">
<div class="number no-6">
<div class="number no-3"></div>
</div>
</div>
Change the spin speeds as per your wish.
I've got a an image I'm using as a background that is animated in CSS, but it is push all of my content to the bottom of the page with plain white background. Does anyone know how I can get it to act more of an animated wallpaper so my content isn't pushed down?
#map {
height: 400px;
width: 400px;
margin: 0 auto;
}
.check {
text-align: center;
}
h3,
h2,
h1,
a {
text-align: center;
background-color: transparent;
}
#sky {
overflow: hidden;
}
#clouds {
width: 200%;
height: 1000px;
background-image: url('https://images.unsplash.com/photo-1455735459330-969b65c65b1c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1652&q=80');
-webkit-animation: movingclouds 25s linear infinite;
-moz-animation: movingclouds 25s linear infinite;
-o-animation: movingclouds 25s linear infinite;
}
#keyframes movingclouds {
0% {
margin-left: 0%;
}
100% {
margin-left: -100%;
}
}
<div id="sky">
<div id="clouds"></div>
</div>
Move the animation to the background position. This way, it will animate behind whatever is on top of it. In this case, I've moved the background to the body, but you can use absolute/relative position as well.
By animating the margin, you push everything to one side, not just the background.
body {
background-image: url('https://images.unsplash.com/photo-1455735459330-969b65c65b1c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1652&q=80');
-webkit-animation: movingclouds 25s linear infinite;
-moz-animation: movingclouds 25s linear infinite;
-o-animation: movingclouds 25s linear infinite;
}
#keyframes movingclouds {
0% {
background-position: 0%;
}
100% {
background-position: -100%;
}
}
Working example: https://jsbin.com/ruyemijasi/edit?html,css,js,output
Is there a way to force animated elements to stay positioned on top of another image?
PROBLEM:
When you resize the browser all of the Animated Elements slide Horizontally and/or Vertically.
Notice the pink square div [as well as the others] move when I resize the screen, I want it to stay in the same place and NOT MOVE.
I've tried to use absolute position on the div, but that doesn't stop
them from moving around on resize. What can I do to keep the elements in a certain spot on the picture?
Please use my fiddle to demonstrate your solution
HTML:
<center>
<div id="wrapper">
<img class="buildingtotal img-responsive" src="http://www.penguins-world.com/wp-content/uploads/emperor_penguin.jpg" >
<div id="animation">
<div class="bubble toprow"> </div>
<div class="bubble toprow"> </div>
<div class="bubble toprow"> </div>
<div class="bubble toprow"> </div>
<div class="bubble bottomrow"> </div>
<div class="bubble bottomrow"> </div>
<div class="bubble bottomrow"> </div>
<div class="bubble bottomrow"> </div>
</div>
<img class="buildingsolo" src="http://i1207.photobucket.com/albums/bb466/audetwebdesign/jsFiddle%20Demos/Puffins.jpg" >
</div>
</center>
CSS:
.toprow{top:0;}
.bottomrow{top:0; margin-top:15%;}
.bubble {
height: 100px;
width: 100px;
position:absolute;
opacity:0;
}
#animation div:nth-of-type(1) {
-webkit-animation: fadein 6s ease-in-out -8s infinite alternate;
-moz-animation: fadein 6s ease-in-out -8s infinite alternate;
animation:fadein 6s ease-in-out -8s infinite alternate;
}
#animation div:nth-of-type(2) {
-webkit-animation: fadein 6s ease-in-out 8s infinite alternate;
-moz-animation: fadein 6s ease-in-out 8s infinite alternate;
animation: fadein 6s ease-in-out 8s infinite alternate;
}
#animation div:nth-of-type(3) {
-webkit-animation: fadein 6s ease-in-out 16s infinite alternate;
-moz-animation: fadein 6s ease-in-out 16s infinite alternate;
animation: fadein 6s ease-in-out 16s infinite alternate;
}
#animation div:nth-of-type(4) {
-webkit-animation: fadein 6s ease-in-out 24s infinite alternate;
-moz-animation: fadein 6s ease-in-out 24s infinite alternate;
animation:fadein 6s ease-in-out 24s infinite alternate;
}
#animation div:nth-of-type(5) {
-webkit-animation: fadein 6s ease-in-out -16s infinite alternate;
-moz-animation: fadein 6s ease-in-out -16s infinite alternate;
animation: fadein 6s ease-in-out -16s infinite alternate;
}
#animation div:nth-of-type(6) {
-webkit-animation: fadein 6s ease-in-out 40s infinite alternate;
-moz-animation: fadein 6s ease-in-out 40s infinite alternate;
animation: fadein 6s ease-in-out 40s infinite alternate;
}
#animation div:nth-of-type(7) {
-webkit-animation: fadein 6s ease-in-out -24s infinite alternate;
-moz-animation: fadein 6s ease-in-out -24s infinite alternate;
animation:fadein 6s ease-in-out -24s infinite alternate;
}
#animation div:nth-of-type(8) {
-webkit-animation: fadein 6s ease-in-out 32s infinite alternate;
-moz-animation: fadein 6s ease-in-out 32s infinite alternate;
animation: fadein 6s ease-in-out 32s infinite alternate;
}
#-webkit-keyframes fadein {
0% {
opacity: 0;
}
66% {
opacity: 0;
}
76% {
opacity: 1;
}
100% {
opacity: 1;
}
}
#-moz-keyframes fadein {
0% {
opacity: 0;
}
66% {
opacity: 0;
}
76% {
opacity: 1;
}
100% {
opacity: 1;
}
}
#keyframes fadein {
0% {
opacity: 0;
}
66% {
opacity: 0;
}
76% {
opacity: 1;
}
100% {
opacity: 1;
}
}
.toprow{top:25%; }
.bottomrow{top:0%; }
.bubble:nth-child(1)
{
background: #ff0; left:10%;
}
.bubble:nth-child(2)
{
background: #333; left:30%;
}
.bubble:nth-child(3)
{
background: #f90; left:60%;
}
.bubble:nth-child(4)
{
background: #e43; left:80%;
}
.bubble:nth-child(5)
{
background: #e38; left:10%;
}
.bubble:nth-child(6)
{
background: #338;left:30%;
}
.bubble:nth-child(7)
{
background: #fdd; left:60%;
}
.bubble:nth-child(8)
{
background: #53d; left:80%;
}
}
#media(max-width:630px)
{
#animation {display:none!important;}
.buildingsolo {display:none !important;}
.buildingtotal {display:block !important; top:0!important;}
}
Wrap each image in a div with position:relative;
<div style="position:relative;">
<div style="position:absolute;"><!--box goes here--></div>
<img .../>
</div>
You can also try:
#wrapper { position:relative; display:inline-block; margin:0 auto; }
EDIT
Make sure the wrapper is the same width as the image, else it will not work:
<div id="wrapper" style="display:inline-block;">
I made an CSS slideshow with 3 images animated by keyframes that makes a fade in/out effect. So far, so well. But there's a problem with the animation on the second loop of the slideshow.
Im going to explain my best: the first loop animation works perfectly, but once the first image come back again there's a fade to white on all the slides that I like to avoid.
I don't understand why the first loop works perfectly and then the other loops have this fade to white issue. You can see this problem on the Snippet.
Help is really apreciated!
.imgbox{
display: flex;
align-items: center;
height: 100%;
width: 100%;
background-position: center center;
background-size: cover;
}
#img1{
position: absolute;
z-index: 3;
-webkit-animation: slideshow 15s linear 0s infinite;
-moz-animation: slideshow 15s linear 0s infinite;
-ms-animation: slideshow 15s linear 0s infinite;
-o-animation: slideshow 15s linear 0s infinite;
animation: slideshow 15s linear 0s infinite;
}
#img2{
position: absolute;
z-index: 2;
-webkit-animation: slideshow 15s linear 5s infinite;
-moz-animation: slideshow 15s linear 5s infinite;
-ms-animation: slideshow 15s linear 5s infinite;
-o-animation: slideshow 15s linear 5s infinite;
animation: slideshow 15s linear 5s infinite;
}
#img3{
position: absolute;
z-index: 1;
-webkit-animation: slideshow 15s linear 10s infinite;
-moz-animation: slideshow 15s linear 10s infinite;
-ms-animation: slideshow 15s linear 10s infinite;
-o-animation: slideshow 15s linear 10s infinite;
animation: slideshow 15s linear 10s infinite;
}
#-webkit-keyframes slideshow {
25% { opacity: 1;}
30% { opacity: 0;}
95% { opacity: 0;}
100% { opacity: 1;}
}
#-moz-keyframes slideshow {
25% { opacity: 1;}
30% { opacity: 0;}
95% { opacity: 0;}
100% { opacity: 1;}
}
#-ms-keyframes slideshow {
25% { opacity: 1;}
30% { opacity: 0;}
95% { opacity: 0;}
100% { opacity: 1;}
}
#-o-keyframes slideshow {
25% { opacity: 1;}
30% { opacity: 0;}
95% { opacity: 0;}
100% { opacity: 1;}
}
#keyframes slideshow {
25% { opacity: 1;}
30% { opacity: 0;}
95% { opacity: 0;}
100% { opacity: 1;}
}
<div id="img1" class="imgbox" style="background-image: url('http://img2.netcarshow.com/Ford-GT90_Concept_1995_800x600_wallpaper_01.jpg');">
</div>
<div id="img2" class="imgbox" style="background-image: url('http://img2.netcarshow.com/Mercedes-Benz-SLR_McLaren_2004_800x600_wallpaper_02.jpg');">
</div>
<div id="img3" class="imgbox" style="background-image: url('http://img2.netcarshow.com/Porsche-911_Carrera_4S_2002_800x600_wallpaper_0d.jpg');">
</div>
.imgbox{
display: flex;
align-items: center;
height: 100%;
width: 100%;
background-position: center center;
background-size: cover;
}
#img1{
position: absolute;
z-index: 3;
animation: xfade 15s -0s infinite;
animation-timing-function: ease-in-out;
}
#img2{
position: absolute;
z-index: 2;
animation: xfade 15s -5s infinite;
animation-timing-function: ease-in-out;
}
#img3{
position: absolute;
z-index: 1;
animation: xfade 15s -10s infinite;
animation-timing-function: ease-in-out;
}
#keyframes xfade{
0% {opacity: 0;}
20% {opacity: 1;}
33% {opacity: 1;}
53% {opacity: 0;}
100% {opacity: 0;}
}
I just set up a jsfiddle with an updated version for you.
https://jsfiddle.net/87axbx1o/
Let me know if that works well for you
I'm trying to create a nice old CRT "tv" effect using animation in CSS, but having some problems with the scanlines displaying above and below the intended div.
What I have is a landing page that has 4 divs that link to other areas of the site. The 1st 2 divs are "TVs" each have a background showing the "tv" (static image) of the content of the link.
On a desktop or other larger screen, the 4 divs are displayed as 2x2, on a smaller screen it's shown in a 1x4 format.
I've created a single image that will be animated with css to fake the moving scanlines moving down the 1st 2 divs.
What's happening is that the "scanlines" appear above the "TVs" and move to below the "TVs".
You can see what's happening on JSFiddle:
http://jsfiddle.net/blyzz/ynekxcud/2/
Here's some cleansed HTML code:
<a href="URL1" target="_blank">
<div class="content" id="outside">
<div class="scanlines">
<div class="aniscan" id="aniscanout">
</div>
<div class="aniscan" id="aniscanout2">
</div>
</div>
</div>
</a>
<a href="URL2" target="_blank">
<div class="content" id="inside">
<div class="scanlines">
<div class="aniscan" id="aniscanin">
</div>
<div class="aniscan" id="aniscanin2">
</div>
</div>
</div>
</a>
and the accompanying cleansed CSS:
.content{
width: 300px;
min-width: 300px;
height: 125px;
min-height: 125px;
float:left;
margin: 5px;
border: 3px solid #555555;
z-index: -100;
}
.scanlines{
width: 100%;
height: 100%;
background-repeat: repeat;
z-index: 100;
}
.aniscan{
width: 100%;
height: 100%;
background-image: url('http://www.oocities.org/~special_effect/holo_scanlines.jpg');
background-repeat: repeat-x;
z-index: 200;
position: relative;
opacity:0.6;
}
#inside {
background-image: url('http://www.clipartbest.com/cliparts/xig/7rM/xig7rMriA.png');
border-radius: 0px 15px 0px 0px;
}
#outside{
background-image: url('http://cdn.graphicsfactory.com/clip-art/image_files/image/6/1347556-2587-Royalty-Free-Dog-With-Big-Bone-In-Mouth.jpg');
border-radius: 15px 0px 0px 0px;
}
#aniscanin{
-webkit-animation: mymove 5.2s linear infinite;
-moz-animation: mymove 5.2s linear infinite;
-o-animation: mymove 5.2s linear infinite;
animation: mymove 5.2s linear infinite;
}
#aniscanin2{
-webkit-animation: mymoveb 5.2s linear infinite;
-moz-animation: mymoveb 5.2s linear infinite;
-o-animation: mymoveb 5.2s linear infinite;
animation: mymoveb 5.2s linear infinite;
}
#aniscanout{
-webkit-animation: mymove 4.8s linear infinite;
-moz-animation: mymove 4.8s linear infinite;
-o-animation: mymove 4.8s linear infinite;
animation: mymove 4.8s linear infinite;
}
#aniscanout2{
-webkit-animation: mymoveb 4.8s linear infinite;
-moz-animation: mymoveb 4.8s linear infinite;
-o-animation: mymoveb 4.8s linear infinite;
animation: mymoveb 4.8s linear infinite;
}
#-webkit-keyframes mymove {
0% {top: -125px;}
100% {top: 0px;}
}
#keyframes mymove {
0% {top: -125px;}
100% {top: 0px;}
}
#-webkit-keyframes mymoveb{
0% {top: -125px;}
100% {top: 0px;}
}
#keyframes mymoveb {
0% {top: -125px;}
100% {top: 0px;}
}
I considered making a "window" with higher z-index divs above and below the 2 TVs, but it doesn't really work well with responsive design.
Any help would be appreciated!
P.S. It'd be nice if i could get the scanlines behind the rounded corners as well, but it's not really a deal-breaker - I can always remove the rounded corners.
You need overflow: hidden in your .content class:
Like this:
.content{
width: 300px;
min-width: 300px;
height: 125px;
min-height: 125px;
float:left;
margin: 5px;
border: 3px solid #555555;
z-index: -100;
overflow: hidden;
}
Fiddle:
http://jsfiddle.net/ynekxcud/3/