How can I add Bootstrap 5 animation to a web page - css

I want to add animations like This one to a background of this page down below, but i don't know how to do that using bootstrap 5, the image i provided up here, i want it to be the background of my html page, How can i do this please?
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">
My Templates:
<div class="container-fluid bg-light bg-body shadow-lg">
<div class="row">
<nav class="navbar navbar-expand-lg navbar-light bg-light bg-body shadow-sm">
<div class="container">
<a class="navbar-brand" href="#" style="color: dodgerblue; font-size: 20px;">DB</a>
<div class="navbar-nav">
<a class="nav-item btn btn-primary mx-lg-2 mx-0 my-lg-0 my-2" href="#">About</a>
<a class="nav-item btn btn-primary mx-lg-2 mx-0 my-lg-0 my-2" href="#">Contact</a>
<a class="nav-item btn btn-primary mx-lg-2 mx-0 my-lg-0 my-2" href="#">Pricing</a>
<a class="nav-item btn btn-primary mx-lg-2 mx-0 my-lg-0 my-2" href="#">Disabled</a>
</div>
</div>
</nav>
<div class="col">
<div class="container p-5">
<h1>Landing Page</h1>
<br>
<h4>Lorem ipsum dolor sit amet consectetur adipisicing elit. Consequuntur recusandae
accusamus enim dolorum sequi saepe unde minima</h4>
<br>
<a class="btn btn-primary shadow-lg bg-body text-dark" href="">Get Started</a>
</div>
</div>
<div class="col-md-6">
<div class="p-5">
<h2 class="text-center">Sign In</h2>
<br>
<form method="POST" action="{% url 'login' %}">
{% csrf_token %}
<div class="form-group">
<label class="text-primary text-dark font-weight-bold">Enter School Name</label>
<input type="text" class="form-control" name="username" placeholder="School Name">
</div>
<br>
<div class="form-group">
<label class="text-primary text-dark font-weight-bold">Enter School Password</label>
<input type="password" class="form-control" name="password" placeholder="Enter Password">
</div>
<br>
<button type="submit" class="btn btn-primary btn-block">Login</button>
</form>
</div>
</div>
</div>
</div>

Just take the code from the fiddle (the compiled css) and use bubbles as the class for your required container. In this case, I used a fixed div as the background of page.
(Wait for it...)
body {
background: #1a1e23;
margin: 0;
}
.bubbles {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
overflow: hidden;
border: 1px solid red;
margin: auto;
}
.bubble {
position: absolute;
left: var(--bubble-left-offset);
bottom: -75%;
display: block;
width: var(--bubble-radius);
height: var(--bubble-radius);
border-radius: 50%;
animation: float-up var(--bubble-float-duration) var(--bubble-float-delay) ease-in infinite;
}
.bubble::before {
position: absolute;
content: "";
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(136, 246, 251, 0.3);
border-radius: inherit;
animation: var(--bubble-sway-type) var(--bubble-sway-duration) var(--bubble-sway-delay) ease-in-out alternate infinite;
}
.bubble:nth-child(0) {
--bubble-left-offset: 70vw;
--bubble-radius: 2vw;
--bubble-float-duration: 10s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 3s;
--bubble-sway-delay: 3s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(1) {
--bubble-left-offset: 92vw;
--bubble-radius: 8vw;
--bubble-float-duration: 8s;
--bubble-sway-duration: 6s;
--bubble-float-delay: 3s;
--bubble-sway-delay: 0s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(2) {
--bubble-left-offset: 60vw;
--bubble-radius: 2vw;
--bubble-float-duration: 10s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 3s;
--bubble-sway-delay: 1s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(3) {
--bubble-left-offset: 93vw;
--bubble-radius: 8vw;
--bubble-float-duration: 9s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 3s;
--bubble-sway-delay: 1s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(4) {
--bubble-left-offset: 77vw;
--bubble-radius: 3vw;
--bubble-float-duration: 9s;
--bubble-sway-duration: 6s;
--bubble-float-delay: 3s;
--bubble-sway-delay: 1s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(5) {
--bubble-left-offset: 36vw;
--bubble-radius: 8vw;
--bubble-float-duration: 12s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 3s;
--bubble-sway-delay: 4s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(6) {
--bubble-left-offset: 33vw;
--bubble-radius: 6vw;
--bubble-float-duration: 11s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 4s;
--bubble-sway-delay: 1s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(7) {
--bubble-left-offset: 84vw;
--bubble-radius: 3vw;
--bubble-float-duration: 7s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 3s;
--bubble-sway-delay: 1s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(8) {
--bubble-left-offset: 3vw;
--bubble-radius: 2vw;
--bubble-float-duration: 11s;
--bubble-sway-duration: 6s;
--bubble-float-delay: 1s;
--bubble-sway-delay: 3s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(9) {
--bubble-left-offset: 89vw;
--bubble-radius: 1vw;
--bubble-float-duration: 11s;
--bubble-sway-duration: 6s;
--bubble-float-delay: 1s;
--bubble-sway-delay: 2s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(10) {
--bubble-left-offset: 87vw;
--bubble-radius: 9vw;
--bubble-float-duration: 8s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 0s;
--bubble-sway-delay: 3s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(11) {
--bubble-left-offset: 98vw;
--bubble-radius: 7vw;
--bubble-float-duration: 12s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 4s;
--bubble-sway-delay: 4s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(12) {
--bubble-left-offset: 80vw;
--bubble-radius: 10vw;
--bubble-float-duration: 7s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 2s;
--bubble-sway-delay: 2s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(13) {
--bubble-left-offset: 97vw;
--bubble-radius: 3vw;
--bubble-float-duration: 9s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 2s;
--bubble-sway-delay: 2s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(14) {
--bubble-left-offset: 28vw;
--bubble-radius: 1vw;
--bubble-float-duration: 10s;
--bubble-sway-duration: 6s;
--bubble-float-delay: 3s;
--bubble-sway-delay: 2s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(15) {
--bubble-left-offset: 64vw;
--bubble-radius: 10vw;
--bubble-float-duration: 8s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 1s;
--bubble-sway-delay: 4s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(16) {
--bubble-left-offset: 3vw;
--bubble-radius: 6vw;
--bubble-float-duration: 8s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 2s;
--bubble-sway-delay: 1s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(17) {
--bubble-left-offset: 14vw;
--bubble-radius: 6vw;
--bubble-float-duration: 6s;
--bubble-sway-duration: 6s;
--bubble-float-delay: 4s;
--bubble-sway-delay: 0s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(18) {
--bubble-left-offset: 41vw;
--bubble-radius: 3vw;
--bubble-float-duration: 6s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 1s;
--bubble-sway-delay: 2s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(19) {
--bubble-left-offset: 31vw;
--bubble-radius: 3vw;
--bubble-float-duration: 11s;
--bubble-sway-duration: 6s;
--bubble-float-delay: 3s;
--bubble-sway-delay: 2s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(20) {
--bubble-left-offset: 49vw;
--bubble-radius: 7vw;
--bubble-float-duration: 7s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 0s;
--bubble-sway-delay: 4s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(21) {
--bubble-left-offset: 89vw;
--bubble-radius: 3vw;
--bubble-float-duration: 9s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 3s;
--bubble-sway-delay: 0s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(22) {
--bubble-left-offset: 47vw;
--bubble-radius: 8vw;
--bubble-float-duration: 12s;
--bubble-sway-duration: 6s;
--bubble-float-delay: 2s;
--bubble-sway-delay: 0s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(23) {
--bubble-left-offset: 93vw;
--bubble-radius: 7vw;
--bubble-float-duration: 12s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 4s;
--bubble-sway-delay: 2s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(24) {
--bubble-left-offset: 72vw;
--bubble-radius: 5vw;
--bubble-float-duration: 10s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 3s;
--bubble-sway-delay: 0s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(25) {
--bubble-left-offset: 68vw;
--bubble-radius: 4vw;
--bubble-float-duration: 9s;
--bubble-sway-duration: 6s;
--bubble-float-delay: 2s;
--bubble-sway-delay: 1s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(26) {
--bubble-left-offset: 15vw;
--bubble-radius: 5vw;
--bubble-float-duration: 12s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 3s;
--bubble-sway-delay: 4s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(27) {
--bubble-left-offset: 20vw;
--bubble-radius: 4vw;
--bubble-float-duration: 11s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 1s;
--bubble-sway-delay: 4s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(28) {
--bubble-left-offset: 51vw;
--bubble-radius: 8vw;
--bubble-float-duration: 10s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 4s;
--bubble-sway-delay: 2s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(29) {
--bubble-left-offset: 31vw;
--bubble-radius: 3vw;
--bubble-float-duration: 9s;
--bubble-sway-duration: 6s;
--bubble-float-delay: 4s;
--bubble-sway-delay: 0s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(30) {
--bubble-left-offset: 45vw;
--bubble-radius: 5vw;
--bubble-float-duration: 10s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 1s;
--bubble-sway-delay: 2s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(31) {
--bubble-left-offset: 9vw;
--bubble-radius: 7vw;
--bubble-float-duration: 10s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 2s;
--bubble-sway-delay: 1s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(32) {
--bubble-left-offset: 62vw;
--bubble-radius: 5vw;
--bubble-float-duration: 6s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 1s;
--bubble-sway-delay: 2s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(33) {
--bubble-left-offset: 8vw;
--bubble-radius: 4vw;
--bubble-float-duration: 6s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 4s;
--bubble-sway-delay: 1s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(34) {
--bubble-left-offset: 76vw;
--bubble-radius: 1vw;
--bubble-float-duration: 8s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 4s;
--bubble-sway-delay: 2s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(35) {
--bubble-left-offset: 22vw;
--bubble-radius: 10vw;
--bubble-float-duration: 10s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 4s;
--bubble-sway-delay: 4s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(36) {
--bubble-left-offset: 82vw;
--bubble-radius: 7vw;
--bubble-float-duration: 9s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 4s;
--bubble-sway-delay: 4s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(37) {
--bubble-left-offset: 30vw;
--bubble-radius: 10vw;
--bubble-float-duration: 8s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 1s;
--bubble-sway-delay: 0s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(38) {
--bubble-left-offset: 96vw;
--bubble-radius: 8vw;
--bubble-float-duration: 8s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 1s;
--bubble-sway-delay: 2s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(39) {
--bubble-left-offset: 13vw;
--bubble-radius: 5vw;
--bubble-float-duration: 8s;
--bubble-sway-duration: 6s;
--bubble-float-delay: 2s;
--bubble-sway-delay: 4s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(40) {
--bubble-left-offset: 8vw;
--bubble-radius: 7vw;
--bubble-float-duration: 11s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 2s;
--bubble-sway-delay: 1s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(41) {
--bubble-left-offset: 66vw;
--bubble-radius: 1vw;
--bubble-float-duration: 9s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 2s;
--bubble-sway-delay: 1s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(42) {
--bubble-left-offset: 11vw;
--bubble-radius: 4vw;
--bubble-float-duration: 10s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 1s;
--bubble-sway-delay: 0s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(43) {
--bubble-left-offset: 57vw;
--bubble-radius: 3vw;
--bubble-float-duration: 11s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 1s;
--bubble-sway-delay: 4s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(44) {
--bubble-left-offset: 53vw;
--bubble-radius: 5vw;
--bubble-float-duration: 12s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 2s;
--bubble-sway-delay: 3s;
--bubble-sway-type: sway-right-to-left;
}
.bubble:nth-child(45) {
--bubble-left-offset: 18vw;
--bubble-radius: 1vw;
--bubble-float-duration: 7s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 4s;
--bubble-sway-delay: 4s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(46) {
--bubble-left-offset: 72vw;
--bubble-radius: 2vw;
--bubble-float-duration: 7s;
--bubble-sway-duration: 4s;
--bubble-float-delay: 0s;
--bubble-sway-delay: 1s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(47) {
--bubble-left-offset: 80vw;
--bubble-radius: 3vw;
--bubble-float-duration: 12s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 1s;
--bubble-sway-delay: 2s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(48) {
--bubble-left-offset: 83vw;
--bubble-radius: 8vw;
--bubble-float-duration: 12s;
--bubble-sway-duration: 6s;
--bubble-float-delay: 1s;
--bubble-sway-delay: 4s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(49) {
--bubble-left-offset: 16vw;
--bubble-radius: 10vw;
--bubble-float-duration: 11s;
--bubble-sway-duration: 5s;
--bubble-float-delay: 4s;
--bubble-sway-delay: 0s;
--bubble-sway-type: sway-left-to-right;
}
.bubble:nth-child(50) {
--bubble-left-offset: 0vw;
--bubble-radius: 7vw;
--bubble-float-duration: 7s;
--bubble-sway-duration: 6s;
--bubble-float-delay: 3s;
--bubble-sway-delay: 4s;
--bubble-sway-type: sway-right-to-left;
}
#keyframes float-up {
to {
transform: translateY(-175vh);
}
}
#keyframes sway-left-to-right {
from {
transform: translateX(-100%);
}
to {
transform: translateX(100%);
}
}
#keyframes sway-right-to-left {
from {
transform: translateX(100%);
}
to {
transform: translateX(-100%);
}
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<div class="container-fluid bg-light bg-body shadow-lg">
<div class="row">
<nav class="navbar navbar-expand-lg navbar-light bg-light bg-body shadow-sm">
<div class="container">
<a class="navbar-brand" href="#" style="color: dodgerblue; font-size: 20px;">DB</a>
<div class="navbar-nav">
<a class="nav-item btn btn-primary mx-lg-2 mx-0 my-lg-0 my-2" href="#">About</a>
<a class="nav-item btn btn-primary mx-lg-2 mx-0 my-lg-0 my-2" href="#">Contact</a>
<a class="nav-item btn btn-primary mx-lg-2 mx-0 my-lg-0 my-2" href="#">Pricing</a>
<a class="nav-item btn btn-primary mx-lg-2 mx-0 my-lg-0 my-2" href="#">Disabled</a>
</div>
</div>
</nav>
<div class="bubbles">
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
</div>
<div class="col position-relative">
<div class="container p-5">
<h1>Landing Page</h1>
<br>
<h4>Lorem ipsum dolor sit amet consectetur adipisicing elit. Consequuntur recusandae accusamus enim dolorum sequi saepe unde minima</h4>
<br>
<a class="btn btn-primary shadow-lg bg-body text-dark" href="">Get Started</a>
</div>
</div>
<div class="col-md-6">
<div class="p-5">
<h2 class="text-center">Sign In</h2>
<br>
<form method="POST" action="{% url 'login' %}">
{% csrf_token %}
<div class="form-group">
<label class="text-primary text-dark font-weight-bold">Enter School Name</label>
<input type="text" class="form-control" name="username" placeholder="School Name">
</div>
<br>
<div class="form-group">
<label class="text-primary text-dark font-weight-bold">Enter School Password</label>
<input type="password" class="form-control" name="password" placeholder="Enter Password">
</div>
<br>
<button type="submit" class="btn btn-primary btn-block">Login</button>
</form>
</div>
</div>
</div>
</div>

Related

Loop animation for css

Please how can I get the animation below to continue looping without javascript, just CSS and HTML. So that when it gets to 7, it will start all over from one again and continues that way until the page is closed. I have been on this for over 3 hours. I will appreciate if anyone can please guide me on this.
Thank you in advance.
.merry {
font-family: "Georgia", serif;
font-style: italic;
font-size: 18px;
text-align: center;
}
.merry-text {
left: 0;
margin-bottom: 0;
margin-top: 50px;
opacity: 0;
position: absolute;
right: 0;
text-align: center;
top: 0;
}
.merry-text:nth-of-type(1) {
animation-name: rotate;
animation-duration: 2.5s;
animation-delay: 1s;
}
.merry-text:nth-of-type(2) {
animation-name: rotate;
animation-duration: 2.5s;
animation-delay: 3s;
}
.merry-text:nth-of-type(3) {
animation-name: rotate;
animation-duration: 2.5s;
animation-delay: 5s;
}
.merry-text:nth-of-type(4) {
animation-name: rotate;
animation-duration: 2.5s;
animation-delay: 7s;
animation-fill-mode: forwards;
}
.merry-text:nth-of-type(5) {
animation-name: rotate;
animation-duration: 2.5s;
animation-delay: 9s;
}
.merry-text:nth-of-type(6) {
animation-name: rotate;
animation-duration: 2.5s;
animation-delay: 11s;
}
.merry-text:nth-of-type(7) {
animation-name: rotate;
animation-duration: 2.5s;
animation-delay: 13s;
}
#keyframes rotate {
0% {
opacity: 0;
transform: translate3d(0, 50px, 0);
}
20%, 80% {
opacity: 1;
transform: translate3d(0, 0, 0);
}
100% {
opacity: 0;
transform: translate3d(0, -25px, 0);
}
}
<p class="merry">
<span class="merry-text">circle 1</span>
<span class="merry-text">circle 2</span>
<span class="merry-text">circle 3 </span>
<span class="merry-text">circle 4</span>
<span class="merry-text">circle 5</span>
<span class="merry-text">circle 6</span>
<span class="merry-text">circle 7</span>
</p>
Simply by using this:
animation-iteration-count: infinite;

CSS Text Animation, replace text

I found a cool, very simple text animation on a website that I would like to rebuild. Here is the link (the animation is in the footer of the page): http://www.motherbird.com.au/process/
I'm not familiar with CSS animations yet, but I've managed that so far:
.animated{
display: inline;
text-indent: 8px;
}
.animated span{
animation: topToBottom 5s infinite 0s;
-ms-animation: topToBottom 5s infinite 0s;
-webkit-animation: topToBottom 5s infinite 0s;
color: red;
opacity: 0;
overflow: hidden;
position: absolute;
}
.animated span:nth-child(2){
animation-delay: 1s;
-ms-animation-delay: 1s;
-webkit-animation-delay: 1s;
}
.animated span:nth-child(3){
animation-delay: 2s;
-ms-animation-delay: 2s;
-webkit-animation-delay: 2s;
}
.animated span:nth-child(4){
animation-delay: 3s;
-ms-animation-delay: 3s;
-webkit-animation-delay: 3s;
}
.animated span:nth-child(5){
animation-delay: 4s;
-ms-animation-delay: 4s;
-webkit-animation-delay: 4s;
}
#-webkit-keyframes topToBottom{
0% { opacity: 0; }
25% { opacity: 0; }
50% { opacity: 0; }
75% { opacity: 0; }
100% { opacity: 1; }
}
<h2>CSS Animations are
<div class="animated">
<span>cool.</span>
<span>neat.</span>
<span>awesome.</span>
<span>groovy.</span>
<span>magic.</span>
</div>
</h2>
How do I make the transition without fade?
Thanks for your help!
Another idea is to consider content of a pseudo element to change the text and you will have less of code:
.animated {
text-indent: 8px;
color:red;
}
.animated:before {
content: "cool.";
animation: topToBottom 5s infinite 0s;
}
#keyframes topToBottom {
0% {
content: "cool.";
}
25% {
content: "neat.";
}
50% {
content: "awesome.";
}
75% {
content: "groovy.";
}
100% {
content: "magic.";
}
}
<h2>CSS Animations are
<span class="animated">
</span>
</h2>
Since the animation-duration takes 5s, which represents 100% of the whole duration, and you have five spans or words, therefore each span will be visible for 1s or 20% of the time, then hidden until the end. Based on that you need to adjust the %'s inside the #keyframes to met the criteria and achieve the desired result:
.animated {
text-indent: 8px;
}
.animated span {
color: red;
opacity: 0;
overflow: hidden;
position: absolute;
-ms-animation: topToBottom 5s infinite;
-webkit-animation: topToBottom 5s infinite;
animation: topToBottom 5s infinite;
}
.animated span:nth-child(2){
-ms-animation-delay: 1s;
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
.animated span:nth-child(3){
-ms-animation-delay: 2s;
-webkit-animation-delay: 2s;
animation-delay: 2s;
}
.animated span:nth-child(4){
-ms-animation-delay: 3s;
-webkit-animation-delay: 3s;
animation-delay: 3s;
}
.animated span:nth-child(5){
-ms-animation-delay: 4s;
-webkit-animation-delay: 4s;
animation-delay: 4s;
}
#-webkit-keyframes topToBottom {
0%, 20% {opacity: 1} /* visible for 1s */
20.01%, 100% {opacity: 0} /* hidden for 4s */
}
<h2 class="animated">
CSS Animations are
<span>cool.</span>
<span>neat.</span>
<span>awesome.</span>
<span>groovy.</span>
<span>magic.</span>
</h2>
Just .01% of a difference between the keyframes makes sure there is no fading effect.
Try visibility: hidden | visible:
.animated{
display: inline;
text-indent: 8px;
position: relative;
}
.animated span{
animation: topToBottom 5s infinite 0s;
-ms-animation: topToBottom 5s infinite 0s;
-webkit-animation: topToBottom 5s infinite 0s;
color: red;
/* display: none; */
overflow: hidden;
position: absolute;
display: inline-block;
visibility: hidden;
}
.animated span:nth-child(2){
animation-delay: 1s;
-ms-animation-delay: 1s;
-webkit-animation-delay: 1s;
}
.animated span:nth-child(3){
animation-delay: 2s;
-ms-animation-delay: 2s;
-webkit-animation-delay: 2s;
}
.animated span:nth-child(4){
animation-delay: 3s;
-ms-animation-delay: 3s;
-webkit-animation-delay: 3s;
}
.animated span:nth-child(5){
animation-delay: 4s;
-ms-animation-delay: 4s;
-webkit-animation-delay: 4s;
}
#-webkit-keyframes topToBottom{
0% { visibility: hidden; }
20% { visibility: hidden; }
40% { visibility: hidden; }
60% { visibility: hidden; }
80% { visibility: hidden; }
100% { visibility: visible; }
}
<h2>CSS Animations are
<div class="animated">
<span>cool.</span>
<span>neat.</span>
<span>awesome.</span>
<span>groovy.</span>
<span>magic.</span>
</div>
</h2>
for 10 words:
.animated{
display: inline;
text-indent: 8px;
position: relative;
}
.animated span{
animation: topToBottom 10s infinite 0s;
-ms-animation: topToBottom 10s infinite 0s;
-webkit-animation: topToBottom 10s infinite 0s;
color: red;
/* display: none; */
overflow: hidden;
position: absolute;
display: inline-block;
visibility: hidden;
}
.animated span:nth-child(2){
animation-delay: 1s;
-ms-animation-delay: 1s;
-webkit-animation-delay: 1s;
}
.animated span:nth-child(3){
animation-delay: 2s;
-ms-animation-delay: 2s;
-webkit-animation-delay: 2s;
}
.animated span:nth-child(4){
animation-delay: 3s;
-ms-animation-delay: 3s;
-webkit-animation-delay: 3s;
}
.animated span:nth-child(5){
animation-delay: 4s;
-ms-animation-delay: 4s;
-webkit-animation-delay: 4s;
}
.animated span:nth-child(6){
animation-delay: 5s;
-ms-animation-delay: 5s;
-webkit-animation-delay: 5s;
}
.animated span:nth-child(7){
animation-delay: 6s;
-ms-animation-delay: 6s;
-webkit-animation-delay: 6s;
}
.animated span:nth-child(8){
animation-delay: 7s;
-ms-animation-delay: 7s;
-webkit-animation-delay: 7s;
}
.animated span:nth-child(9){
animation-delay: 8s;
-ms-animation-delay: 8s;
-webkit-animation-delay: 8s;
}
.animated span:nth-child(10){
animation-delay: 9s;
-ms-animation-delay: 9s;
-webkit-animation-delay: 9s;
}
#-webkit-keyframes topToBottom{
0% { visibility: hidden; }
10% { visibility: hidden; }
20% { visibility: hidden; }
30% { visibility: hidden; }
40% { visibility: hidden; }
50% { visibility: hidden; }
60% { visibility: hidden; }
70% { visibility: hidden; }
80% { visibility: hidden; }
90% { visibility: hidden; }
100% { visibility: visible; }
}
<h2>CSS Animations are
<div class="animated">
<span>cool.</span>
<span>neat.</span>
<span>awesome.</span>
<span>groovy.</span>
<span>magic.</span>
<span>more.</span>
<span>lorem.</span>
<span>pixel.</span>
<span>word.</span>
<span>ten.</span>
</div>
</h2>

Vertically centering Font Awesome icons with transition

I've got these animated divs with a round border with Font Awesome icons in them. What's the best way to vertically align them while keeping them in the middle throughout the transition?
Here's the animation on CodePen
body {
background-color: #3498db;
}
.social {
position: absolute;
font-size: 36px;
color: white;
width: 50px;
height: 50px;
border: 4px solid white;
border-radius: 50%;
text-align: center;
padding: 3px;
transition: all 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55);
transform-origin: 50% 50%;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
}
.social a:visited {
color: currentColor;
}
.social:hover {
background-color: white;
color: #3498db;
width: 80px;
height: 80px;
transform-origin: 50% 50%;
}
#facebook {
animation-name: facebook;
animation-duration: 1000ms;
animation-timing-function: ease-in-out;
animation-delay: 0s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#keyframes facebook {
0% {
transform: translate(148px, 78px);
}
100% {
transform: translate(148px, 84px);
}
}
#twitter {
animation-name: twitter;
animation-duration: 950ms;
animation-timing-function: ease-in-out;;
animation-delay: 0s;
animation-iteration-count: infinite;;
animation-direction: alternate;
}
#keyframes twitter {
0% {transform: translate(-178px, -160px);}
100% {transform: translate(-178px, -164px);}
}
#linkedin {
animation-name: linkedin;
animation-duration: 900ms;
animation-timing-function: ease-in-out;;
animation-delay: 0s;
animation-iteration-count: infinite;;
animation-direction: alternate;
}
#keyframes linkedin {
0% {transform: translate(168px, -77px);}
100% {transform: translate(168px, -84px);}
}
#github {
animation-name: github;
animation-duration: 950ms;
animation-timing-function: ease-in-out;;
animation-delay: 0s;
animation-iteration-count: infinite;;
animation-direction: alternate;
}
#keyframes github {
0% {transform: translate(-198px, 58px);}
100% {transform: translate(-198px, 54px);}
}
#phone {
animation-name: phone;
animation-duration: 900ms;
animation-timing-function: ease-in-out;;
animation-delay: 0s;
animation-iteration-count: infinite;;
animation-direction: alternate;
}
#keyframes phone {
0% {transform: translate(0px, -220px);}
100% {transform: translate(0px, -216px);}
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
<div id='bubbles'>
<div id="facebook" class="social"><span class="fa fa-facebook" aria-hidden="true"></div>
<div id="twitter" class="social"><span class="fa fa-twitter" aria-hidden="true"></div>
<div id="linkedin" class="social"><span class="fa fa-linkedin" aria-hidden="true"></div>
<div id="github" class="social"><span class="fa fa-github" aria-hidden="true"></div>
<div id="phone" class="social"><span class="fa fa-phone" aria-hidden="true"></div>
</div>
Just with simply adding this to your CSS
CSS
.social span{
position: relative;
top: 50%;
transform: translateY(-50%);
}
body {
background-color: #3498db;
}
.social {
position: absolute;
font-size: 36px;
color: white;
width: 50px;
height: 50px;
border: 4px solid white;
border-radius: 50%;
padding: 3px;
transition: all 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55);
transform-origin: 50% 50%;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
}
.social a:visited {
color: currentColor;
}
.social:hover {
background-color: white;
color: #3498db;
width: 80px;
height: 80px;
transform-origin: 50% 50%;
}
#facebook {
animation-name: facebook;
animation-duration: 1000ms;
animation-timing-function: ease-in-out;
animation-delay: 0s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#keyframes facebook {
0% {
transform: translate(148px, 78px);
}
100% {
transform: translate(148px, 84px);
}
}
#twitter {
animation-name: twitter;
animation-duration: 950ms;
animation-timing-function: ease-in-out;
;
animation-delay: 0s;
animation-iteration-count: infinite;
;
animation-direction: alternate;
}
#keyframes twitter {
0% {
transform: translate(-178px, -160px);
}
100% {
transform: translate(-178px, -164px);
}
}
#linkedin {
animation-name: linkedin;
animation-duration: 900ms;
animation-timing-function: ease-in-out;
;
animation-delay: 0s;
animation-iteration-count: infinite;
;
animation-direction: alternate;
}
#keyframes linkedin {
0% {
transform: translate(168px, -77px);
}
100% {
transform: translate(168px, -84px);
}
}
#github {
animation-name: github;
animation-duration: 950ms;
animation-timing-function: ease-in-out;
;
animation-delay: 0s;
animation-iteration-count: infinite;
;
animation-direction: alternate;
}
#keyframes github {
0% {
transform: translate(-198px, 58px);
}
100% {
transform: translate(-198px, 54px);
}
}
#phone {
animation-name: phone;
animation-duration: 900ms;
animation-timing-function: ease-in-out;
;
animation-delay: 0s;
animation-iteration-count: infinite;
;
animation-direction: alternate;
}
#keyframes phone {
0% {
transform: translate(0px, -220px);
}
100% {
transform: translate(0px, -216px);
}
}
.social span {
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" />
<div id='bubbles'>
<a href="https://www.facebook.com/" target="_blank">
<div id="facebook" class="social"><span class="fa fa-facebook" aria-hidden="true"></div></a>
<div id="twitter" class="social"><span class="fa fa-twitter" aria-hidden="true"></div>
<div id="linkedin" class="social"><span class="fa fa-linkedin" aria-hidden="true"></div>
<div id="github" class="social"><span class="fa fa-github" aria-hidden="true"></div>
<div id="phone" class="social"><span class="fa fa-phone" aria-hidden="true"></div>
</div>
Add line-height: 80px; to your .social class
.social:hover {
height: 80px;
line-height: 80px;
}
body {
background-color: #3498db;
}
.social {
position: absolute;
font-size: 36px;
color: white;
width: 50px;
height: 50px;
line-height: 50px;
border: 4px solid white;
border-radius: 50%;
text-align: center;
padding: 3px;
transition: all 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55);
transform-origin: 50% 50%;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
}
.social a:visited {
color: currentColor;
}
.social:hover {
background-color: white;
color: #3498db;
width: 80px;
height: 80px;
line-height: 80px;
transform-origin: 50% 50%;
}
#facebook {
animation-name: facebook;
animation-duration: 1000ms;
animation-timing-function: ease-in-out;
animation-delay: 0s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#keyframes facebook {
0% {
transform: translate(148px, 78px);
}
100% {
transform: translate(148px, 84px);
}
}
#twitter {
animation-name: twitter;
animation-duration: 950ms;
animation-timing-function: ease-in-out;
;
animation-delay: 0s;
animation-iteration-count: infinite;
;
animation-direction: alternate;
}
#keyframes twitter {
0% {
transform: translate(-178px, -160px);
}
100% {
transform: translate(-178px, -164px);
}
}
#linkedin {
animation-name: linkedin;
animation-duration: 900ms;
animation-timing-function: ease-in-out;
;
animation-delay: 0s;
animation-iteration-count: infinite;
;
animation-direction: alternate;
}
#keyframes linkedin {
0% {
transform: translate(168px, -77px);
}
100% {
transform: translate(168px, -84px);
}
}
#github {
animation-name: github;
animation-duration: 950ms;
animation-timing-function: ease-in-out;
;
animation-delay: 0s;
animation-iteration-count: infinite;
;
animation-direction: alternate;
}
#keyframes github {
0% {
transform: translate(-198px, 58px);
}
100% {
transform: translate(-198px, 54px);
}
}
#phone {
animation-name: phone;
animation-duration: 900ms;
animation-timing-function: ease-in-out;
;
animation-delay: 0s;
animation-iteration-count: infinite;
;
animation-direction: alternate;
}
#keyframes phone {
0% {
transform: translate(0px, -220px);
}
100% {
transform: translate(0px, -216px);
}
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
<div id='bubbles'>
<a href="https://www.facebook.com/" target="_blank">
<div id="facebook" class="social"><span class="fa fa-facebook" aria-hidden="true"></div>
</a>
<a href="https://twitter.com/" target="_blank">
<div id="twitter" class="social"><span class="fa fa-twitter" aria-hidden="true"></div>
</a>
<a href="https://www.linkedin.com/" target="_blank">
<div id="linkedin" class="social"><span class="fa fa-linkedin" aria-hidden="true"></div>
</a>
<a href="https://www.github.com/" target="_blank">
<div id="github" class="social"><span class="fa fa-github" aria-hidden="true"></div>
</a>
<a href="https://www.facebook.com/" target="_blank">
<div id="phone" class="social"><span class="fa fa-phone" aria-hidden="true"></div>
</a>
</div>
You can use display:table for outer container and display:table-cell and vertical-align:middle for inner element
#facebook, #twitter, #linkedin, #github, #phone {
display:table;
margin:auto
}
.fa {
display:table-cell;
vertical-align:middle
}
irrespective of height it will vertically center the inner content and it is also compatible with older browsers as well http://caniuse.com/#search=vertical-align
body {
background-color: #3498db;
}
.fa {
display:table-cell !important;
vertical-align: middle;
}
.social {
position: absolute;
font-size: 36px;
color: white;
width: 50px;
height: 50px;
border: 4px solid white;
border-radius: 50%;
text-align: center;
padding: 3px;
transition: all 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55);
transform-origin: 50% 50%;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
}
.social a:visited {
color: currentColor;
}
.social:hover {
background-color: white;
color: #3498db;
width: 80px;
height: 80px;
transform-origin: 50% 50%;
}
#facebook {
animation-name: facebook;
animation-duration: 1000ms;
animation-timing-function: ease-in-out;
animation-delay: 0s;
animation-iteration-count: infinite;
animation-direction: alternate;
display:table;
margin:auto;
}
#keyframes facebook {
0% {
transform: translate(148px, 78px);
}
100% {
transform: translate(148px, 84px);
}
}
#twitter {
animation-name: twitter;
animation-duration: 950ms;
animation-timing-function: ease-in-out;;
animation-delay: 0s;
animation-iteration-count: infinite;;
animation-direction: alternate;
display:table;
margin:auto;
}
#keyframes twitter {
0% {transform: translate(-178px, -160px);}
100% {transform: translate(-178px, -164px);}
}
#linkedin {
animation-name: linkedin;
animation-duration: 900ms;
animation-timing-function: ease-in-out;;
animation-delay: 0s;
animation-iteration-count: infinite;;
animation-direction: alternate;
display:table;
margin:auto;
}
#keyframes linkedin {
0% {transform: translate(168px, -77px);}
100% {transform: translate(168px, -84px);}
}
#github {
animation-name: github;
animation-duration: 950ms;
animation-timing-function: ease-in-out;;
animation-delay: 0s;
animation-iteration-count: infinite;;
animation-direction: alternate;
display:table;
margin:auto;
}
#keyframes github {
0% {transform: translate(-198px, 58px);}
100% {transform: translate(-198px, 54px);}
}
#phone {
animation-name: phone;
animation-duration: 900ms;
animation-timing-function: ease-in-out;;
animation-delay: 0s;
animation-iteration-count: infinite;;
animation-direction: alternate;
display:table;
margin:auto;
}
#keyframes phone {
0% {transform: translate(0px, -220px);}
100% {transform: translate(0px, -216px);}
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
<div id='bubbles'>
<div id="facebook" class="social"><span class="fa fa-facebook" aria-hidden="true"></div>
<div id="twitter" class="social"><span class="fa fa-twitter" aria-hidden="true"></div>
<div id="linkedin" class="social"><span class="fa fa-linkedin" aria-hidden="true"></div>
<div id="github" class="social"><span class="fa fa-github" aria-hidden="true"></div>
<div id="phone" class="social"><span class="fa fa-phone" aria-hidden="true"></div>
</div>

CSS slideshow - How can I add a link to the image?

How can I add a link to these images. I've tried many variations of slideshows but find when I add links it starts not displaying every other image. In my code below I have the links commented out. If I remove the links the images display fine.
I have repeated the images twice just trying to debug and have _parent tag in the link because this page will be displayed in an iframe.
Your help would be greatly appreciated. Thank you for your time reading this post.
HTML
<div class="slider">
<img class='photo' src="featuredProducts/On-Semi-Python-sensors-sm.png"/>
</div>
CSS
.slider {
margin: 0;
width: 180px;
height: 1504px;
overflow: hidden;
position: relative;
}
.photo {
position: absolute;
-webkit-animation: round 16s infinite;
opacity: 0;
width: 100%;
}
#-webkit-keyframes round {
25% {
opacity: 1;
}
40% {
opacity: 0;
}
}
.slider img:nth-child(4) {
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-ms-animation-delay: 12s;
-o-animation-delay: 12s;
animation-delay: 12s;
}
.slider img:nth-child(3) {
-webkit-animation-delay: 8s;
-moz-animation-delay: 8s;
-ms-animation-delay: 8s;
-o-animation-delay: 8s;
animation-delay: 8s;
}
.slider img:nth-child(2) {
-webkit-animation-delay: 4s;
-moz-animation-delay: 4s;
-ms-animation-delay: 4s;
-o-animation-delay: 4s;
animation-delay: 4s;
}
.slider img:nth-child(1) {
-webkit-animation-delay: 0s;
-moz-animation-delay: 0s;
-ms-animation-delay: 0s;
-o-animation-delay: 0s;
animation-delay: 0s;
}
The problem is correctly with your links.
You have <img> inside anchor, but you try to hide img and leaves its parent anchor visible.
It is impossiple after that to make another image visible until the left parent anchor is hidden. Thus you see a blank white area until time passes to hide this left anchor and a new img can appear.
Solution is to hide the parent anchor of each img to have the right effect.
There are two steps:
HTML : Change class photo from img to anchor
CSS : Change selector to .slider a:nth-child(...)
This modified code works
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<link rel="stylesheet" href="test.css" type="text/css">
</head>
<body>
<div class="slider">
<!--
<img class='photo' src="1.jpg" alt="" />
<img class='photo' src="2.jpg" alt="" />
<img class='photo' src="3.jpg" alt="" />
-->
<a class='photo' href="http://www.google.com" target="_parent" ><img src="1.jpg" alt="On Semi PYTHON sensors" /></a>
<a class='photo' href="http://www.youtube.com" target="_parent" ><img src="2.jpg" alt="" /></a>
<a class='photo' href="http://www.pinterest.com" target="_parent" ><img src="3.jpg" alt="" /></a>
<a class='photo' href="http://www.facebook.com" target="_parent" ><img src="4.jpg" alt="" /></a>
</div>
</body>
</html>
CSS
.slider { margin: 0; width: 180px; height: 1504px; overflow: hidden; position: relative; }
.photo { position: absolute; -webkit-animation: round 16s infinite; opacity: 0; width: 100%; }
#-webkit-keyframes round { 25% { opacity: 1; } 40% { opacity: 0; } }
.slider a:nth-child(4) {
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-ms-animation-delay: 12s;
-o-animation-delay: 12s;
animation-delay: 12s;
}
.slider a:nth-child(3) {
-webkit-animation-delay: 8s;
-moz-animation-delay: 8s;
-ms-animation-delay: 8s;
-o-animation-delay: 8s;
animation-delay: 8s;
}
.slider a:nth-child(2) {
-webkit-animation-delay: 4s;
-moz-animation-delay: 4s;
-ms-animation-delay: 4s;
-o-animation-delay: 4s;
animation-delay: 4s;
}
.slider a:nth-child(1) {
-webkit-animation-delay: 0s;
-moz-animation-delay: 0s;
-ms-animation-delay: 0s;
-o-animation-delay: 0s;
animation-delay: 0s;
}
Thats because of position: absolute for the images with photo class. You my remove the position: absolute from photo and add it to a elements instead.
.slider a{
position: absolute;
display: block;
}
.photo {
-webkit-animation: round 16s infinite;
opacity: 0;
width: 100%;
}
just replace .slide img with .slide a
.slider {
margin: 0;
width: 180px;
height: 1504px;
overflow: hidden;
position: relative;
}
a {
position: absolute;
-webkit-animation: round 16s infinite;
opacity: 0;
}
img {
width: 100%;
}
#-webkit-keyframes round {
25% {
opacity: 1;
}
40% {
opacity: 0;
}
}
.slider a:nth-child(4) {
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-ms-animation-delay: 12s;
-o-animation-delay: 12s;
animation-delay: 12s;
}
.slider a:nth-child(3) {
-webkit-animation-delay: 8s;
-moz-animation-delay: 8s;
-ms-animation-delay: 8s;
-o-animation-delay: 8s;
animation-delay: 8s;
}
.slider a:nth-child(2) {
-webkit-animation-delay: 4s;
-moz-animation-delay: 4s;
-ms-animation-delay: 4s;
-o-animation-delay: 4s;
animation-delay: 4s;
}
.slider a:nth-child(1) {
-webkit-animation-delay: 0s;
-moz-animation-delay: 0s;
-ms-animation-delay: 0s;
-o-animation-delay: 0s;
animation-delay: 0s;
}
<div class="slider">
<img class='photo' src="http://i.imgur.com/IMiabf0.jpg" alt="On Semi PYTHON sensors" />
<img class='photo' src="http://i.imgur.com/NqCM7jH.jpg" alt="" />
<img class='photo' src="http://i.imgur.com/cjN8Qoa.jpg" alt="" />
<img class='photo' src="http://i.imgur.com/WQ2RS6O.png" alt="" />
</div>
The code below helped. The images display nicely, but I need to link to separate pages for the images. Even when another image is displayed, the first link is active - in other words the links aren't mapping link2 with image2, link3 with image3...
Please take a look below and let me know if you see how to fix it. Thank you!
.slider {
margin: 0;
width: 180px;
height: 1504px;
overflow: hidden;
position: relative;
}
.slider a {
position: absolute;
-webkit-animation: round 16s infinite;
opacity: 0;
}
img {
width: 100%;
}
#-webkit-keyframes round {
25% {
opacity: 1;
}
40% {
opacity: 0;
}
}
.slider a:nth-child(4) {
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-ms-animation-delay: 12s;
-o-animation-delay: 12s;
animation-delay: 12s;
}
.slider a:nth-child(3) {
-webkit-animation-delay: 8s;
-moz-animation-delay: 8s;
-ms-animation-delay: 8s;
-o-animation-delay: 8s;
animation-delay: 8s;
}
.slider a:nth-child(2) {
-webkit-animation-delay: 4s;
-moz-animation-delay: 4s;
-ms-animation-delay: 4s;
-o-animation-delay: 4s;
animation-delay: 4s;
}
.slider a:nth-child(1) {
-webkit-animation-delay: 0s;
-moz-animation-delay: 0s;
-ms-animation-delay: 0s;
-o-animation-delay: 0s;
animation-delay: 0s;
}
<div class="slider">
<img class='photo' src="http://i.imgur.com/IMiabf0.jpg" alt="On Semi PYTHON sensors" />
<img class='photo' src="http://i.imgur.com/NqCM7jH.jpg" alt="" />
<img class='photo' src="http://i.imgur.com/cjN8Qoa.jpg" alt="" />
<img class='photo' src="http://i.imgur.com/WQ2RS6O.png" alt="" />
</div>

Animated text gets hidden after completion of the animation

I had tried a simple animation. See this fiddle.
HTML:
<div class="special_sec">
<span class="sub_heading">About Us</span>
<span class="sub_heading1">Services</span>
<span class="sub_heading2">Portfolio</span>
<span class="sub_heading3">Clients</span>
<span class="sub_heading4">Contact Us</span>
</div>
CSS:
.special_sec span {
font-size:30px;
list-style:none;
text-align:center;
padding:10px 0;
display:block;
animation:subheadinganimation 17s;
color: transparent;
}
In my CSS (.special_sec span), I have added color: transparent.
My problem is:
If color is transparent, after the animation all the text are getting hidden. See my fiddle.
If I remove this color property, all the text are initially visible. Then the animation also runs. See this fiddle.
I want the text to be visible only after the delay timings that I have given. I can't understand the problem. What is the issue? How can I fix this?
You need to set the animation-fill-mode as forwards so that the element would hold the state as at the final keyframe of the animation (which is color: #000). Without this setting, the element reverts back to its original state (color: transparent) after the animation is complete.
animation: subheadinganimation 17s forwards;
#keyframes subheadinganimation {
0%, 30% {
opacity: 0;
-webkit-transform: translateX(-2000px);
-ms-transform: translateX(-2000px);
transform: translateX(-2000px);
}
33%,
100% {
opacity: 1;
-webkit-transform: translateX(0);
-ms-transform: translateX(0);
transform: translateX(0);
color: #000;
}
}
.special_sec span {
font-size: 30px;
list-style: none;
text-align: center;
padding: 10px 0;
display: block;
animation: subheadinganimation 17s forwards;
color: transparent;
}
span.sub_heading {
-webkit-animation-delay: 0s;
-moz-animation-delay: 0s;
-ms-animation-delay: 0s;
animation-delay: 0s;
}
span.sub_heading1 {
-webkit-animation-delay: 3s;
-moz-animation-delay: 3s;
-ms-animation-delay: 3s;
animation-delay: 3s;
}
span.sub_heading2 {
-webkit-animation-delay: 6s;
-moz-animation-delay: 6s;
-ms-animation-delay: 6s;
animation-delay: 6s;
}
span.sub_heading3 {
-webkit-animation-delay: 9s;
-moz-animation-delay: 9s;
-ms-animation-delay: 9s;
animation-delay: 9s;
}
span.sub_heading4 {
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-ms-animation-delay: 12s;
animation-delay: 12s;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
<div class="special_sec">
<span class="sub_heading">About Us</span>
<span class="sub_heading1">Services</span>
<span class="sub_heading2">Portfolio</span>
<span class="sub_heading3">Clients</span>
<span class="sub_heading4">Contact Us</span>
</div>

Resources