I'm trying to use HTML and CSS to crossfade two images after showing them for 10 seconds each. I want this to repeat constantly.
Here is my HTML:
<div id="container">
<img class="bottom" src="1.png">
<img class="top" src="2.png">
</div>
CSS:
#container {
float: right;
height: 246px;
position:relative;
width: 230px;
}
#container img {
height: 246px;
width: 230px;
left:0;
opacity: 0;
position:absolute;
}
#container img.bottom {
opacity: 1;
}
#container img.top {
animation-duration: 0.1s;
animation-name: crossFade;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#keyframes crossFade {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
I've never used CSS animations before so I'm a bit confused. Only the "bottom" image is being shown and nothing else happens.
What is going wrong?
Here is an example with 10s delay and 1s animation duration.
#container {
float: right;
height: 246px;
position: relative;
width: 230px;
}
#container img {
height: 246px;
width: 230px;
left: 0;
opacity: 0;
position: absolute;
}
#container img.bottom {
opacity: 1;
}
#container img.top {
-webkit-animation: crossFade 11s infinite;
animation: crossFade 11s infinite;
-webkit-animation-direction: alternate;
animation-direction: alternate;
}
#-webkit-keyframes crossFade {
0% {
opacity: 0;
}
47.62% {
opacity: 0;
}
52.38% {
opacity: 1;
}
100% {
opacity: 1;
}
}
#keyframes crossFade {
0% {
opacity: 0;
}
47.62% {
opacity: 0;
}
52.38% {
opacity: 1;
}
100% {
opacity: 1;
}
}
<div id="container">
<img class="bottom" src="https://dummyimage.com/200x200/404/fff">
<img class="top" src="https://dummyimage.com/200x200/101/fff">
</div>
Related
How do I get the three columns to display next to each other rather than on top of each other? Of course I also want them to be responsive and fade.
My fiddle: https://jsfiddle.net/Spleendrivel/dswufb78/3/
<!DOCTYPE html>
<html>
<head>
<meta name="ac:base" content="/AlmostYou">
<base href="/AlmostYou/">
<style>
/* Slider */
/* Slideshow container */
#slide-container-1 {
position: relative;
max-width: 100%;
/* responsiveness */
}
/* Slider */
/* Slideshow container */
#slide-container-2 {
position: relative;
max-width: 100%;
/* responsiveness */
}
/* Slider */
/* Slideshow container */
#slide-container-3 {
position: relative;
max-width: 100%;
/* responsiveness */
}
/* First element to be in block mode for responsiveness */
#slide-element-1 {
display: block;
/* to get the dimensions set */
width: 100%;
height: auto;
}
/* First element to be in block mode for responsiveness */
#slide-element-4 {
display: block;
/* to get the dimensions set */
width: 100%;
height: auto;
}
/* First element to be in block mode for responsiveness */
#slide-element-7 {
display: block;
/* to get the dimensions set */
width: 100%;
height: auto;
}
/* Other element to be in absolute position */
#slide-element-2,
#slide-element-3,
#slide-element-5,
#slide-element-6,
#slide-element-8,
#slide-element-9 {
position: absolute;
width: 100%;
height: 100%;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
/* Style images */
.slide-image {
width: 100%;
border-radius: 20px;
}
/* Style text */
.slide-text {
position: absolute;
bottom: 10px;
background-color: #0042b1bb;
color: white;
width: 100%;
text-align: center;
font-size: 1.5rem;
}
/* Animation settings for individual elements */
/* For more images the animations have to be adjusted */
#slide-element-1 {
animation: fade-1 10s infinite;
-webkit-animation: fade-1 10s infinite;
}
#slide-element-2 {
animation: fade-2 10s infinite;
-webkit-animation: fade-2 10s infinite;
}
#slide-element-3 {
animation: fade-3 10s infinite;
-webkit-animation: fade-3 10s infinite;
}
#slide-element-4 {
animation: fade-4 10s infinite;
-webkit-animation: fade-4 10s infinite;
}
#slide-element-5 {
animation: fade-5 10s infinite;
-webkit-animation: fade-5 10s infinite;
}
#slide-element-6 {
animation: fade-6 10s infinite;
-webkit-animation: fade-6 10s infinite;
}
#slide-element-7 {
animation: fade-7 10s infinite;
-webkit-animation: fade-7 10s infinite;
}
#slide-element-8 {
animation: fade-8 10s infinite;
-webkit-animation: fade-8 10s infinite;
}
#slide-element-9 {
animation: fade-9 10s infinite;
-webkit-animation: fade-9 10s infinite;
}
/* and more if there are more slides to show */
#keyframes fade-1 {
0% {
opacity: 1;
}
33% {
opacity: 0;
}
66% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes fade-2 {
0% {
opacity: 0;
}
33% {
opacity: 1;
}
66% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#keyframes fade-3 {
0% {
opacity: 0;
}
33% {
opacity: 0;
}
66% {
opacity: 1;
}
100% {
opacity: 0;
}
}
#keyframes fade-4 {
0% {
opacity: 1;
}
33% {
opacity: 0;
}
66% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes fade-5 {
0% {
opacity: 0;
}
33% {
opacity: 1;
}
66% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#keyframes fade-6 {
0% {
opacity: 0;
}
33% {
opacity: 0;
}
66% {
opacity: 1;
}
100% {
opacity: 0;
}
}
#keyframes fade-7 {
0% {
opacity: 1;
}
33% {
opacity: 0;
}
66% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes fade-8 {
0% {
opacity: 0;
}
33% {
opacity: 1;
}
66% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#keyframes fade-9 {
0% {
opacity: 0;
}
33% {
opacity: 0;
}
66% {
opacity: 1;
}
100% {
opacity: 0;
}
}
</style>
</head>
<body>
<div class="row">
<div class="column">
<div id="slide-container-1">
<div id="slide-element-1">
<img class="slide-image" src="barn-3.jpg">
</div>
<div id="slide-element-2">
<img class="slide-image" src="barn-2.jpg">
</div>
<div id="slide-element-3">
<img class="slide-image" src="barn-1.jpg">
</div>
</div>
</div>
<div class="column">
<div id="slide-container-2">
<div id="slide-element-4">
<img class="slide-image" src="cat-1.jpg">
</div>
<div id="slide-element-5">
<img class="slide-image" src="cat-2.jpg">
</div>
<div id="slide-element-6">
<img class="slide-image" src="cat-3.jpg">
</div>
</div>
</div>
<div class="column">
<div id="slide-container-3">
<div id="slide-element-7">
<img class="slide-image" src="dog-2.jpg">
</div>
<div id="slide-element-8">
<img class="slide-image" src="dog-1.jpg">
</div>
<div id="slide-element-9">
<img class="slide-image" src="dog-3.jpg">
</div>
</div>
</div>
</div>
</body>
</html>
Make sure the screen width is no more than 350 to see my problem.
I am adding additional lines of text over and over because I can not submit my question without more text content. I am adding additional lines of text over and over because I can not submit my question without more text content. I am adding additional lines of text over and over because I can not submit my question without more text content. I am adding additional lines of text over and over because I can not submit my question without more text content. I am adding additional lines of text over and over because I can not submit my question without more text content.
I guess you have to use css grid or flexbox;
but css grid is the best choice here:
.row {
display: grid;
grid-templates-rows: auto; // you can add columns as many as you want..
grid-templates-columns: repeat(3, 1fr); //.. but you will get 3 columns for each row
}
if didn't work then you have to make some changes in your css.
I think you can try using flexbox (flex-direction: row)
Here is the final answer:
my JSFiddle: https://jsfiddle.net/Spleendrivel/mcyvpx3r/2/
<!DOCTYPE html>
<html>
<head>
<meta name="ac:base" content="/AlmostYou">
<base href="/AlmostYou/">
<style>
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: Arial;
}
.header {
text-align: center;
padding: 32px;
}
.row {
display: -ms-flexbox;
/* IE10 */
display: flex;
-ms-flex-wrap: wrap;
/* IE10 */
flex-wrap: wrap;
padding: 0 4px;
}
/* Create four equal columns that sits next to each other */
.column {
-ms-flex: 33%;
/* IE10 */
flex: 33%;
max-width: 33%;
padding: 0 4px;
}
.column img {
margin-top: 8px;
vertical-align: middle;
width: 100%;
}
.fadein-1 img {
position: absolute;
top: 0;
-webkit-animation-name: fade;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 6s;
animation-name: fade;
animation-iteration-count: infinite;
animation-duration: 6s;
-ms-flex: 33%;
/* IE10 */
flex: 33%;
max-width: 33%;
padding: 0 4px;
}
.fadein-2 img {
position: absolute;
top: 0;
-webkit-animation-name: fade;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 6s;
animation-name: fade;
animation-iteration-count: infinite;
animation-duration: 6s;
-ms-flex: 33%;
/* IE10 */
flex: 33%;
max-width: 33%;
padding: 0 4px;
}
.fadein-3 img {
position: absolute;
top: 0;
-webkit-animation-name: fade;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 6s;
animation-name: fade;
animation-iteration-count: infinite;
animation-duration: 6s;
-ms-flex: 33%;
/* IE10 */
flex: 33%;
max-width: 33%;
padding: 0 4px;
}
#-webkit-keyframes fade {
0% {
opacity: 0;
}
20% {
opacity: 1;
}
33% {
opacity: 1;
}
53% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#keyframes fade {
0% {
opacity: 0;
}
20% {
opacity: 1;
}
33% {
opacity: 1;
}
53% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#f2 {
-webkit-animation-delay: -4s;
}
#f3 {
-webkit-animation-delay: -2s;
}
#f5 {
-webkit-animation-delay: -4s;
}
#f6 {
-webkit-animation-delay: -2s;
}
#f8 {
-webkit-animation-delay: -4s;
}
#f9 {
-webkit-animation-delay: -2s;
}
</style>
</head>
<body>
<div class="row">
<div class="column">
<div class="fadein-1">
<img id="f3" src="http://snaklvr.com/barn-3.jpg">
<img id="f2" src="http://snaklvr.com/barn-2.jpg">
<img src="http://snaklvr.com/barn-1.jpg">
</div>
</div>
<div class="column">
<div class="fadein-2">
<img src="http://snaklvr.com/cat-3.jpg">
<img id="f5" src="http://snaklvr.com/cat-2.jpg">
<img id="f6" src="http://snaklvr.com/cat-1.jpg">
</div>
</div>
<div class="column">
<div class="fadein-3">
<img src="http://snaklvr.com/dog-3.jpg">
<img id="f8" src="http://snaklvr.com/dog-2.jpg">
<img id="f9" src="http://snaklvr.com/dog-1.jpg">
</div>
</div>
</div>
</body>
</html>
I am sure there is some unnecessary CSS or possibly redundancy, but it works as I need!
Flex is your best friend when it comes to arranging elements in a grid and not using a framework such as bootstrap. Here's a great resource for you: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
Also, if any of the answers fixed your issue, please mark it as accepted.
I'm trying to use CSS or jQuery to constantly switch between two images. What I have works ok, but it's essentially placing an image on top of the other one, which causes issues if the images I'm using are transparent.
section {
position: relative;
}
section img {
position: absolute;
width: 200px;
}
.top {
animation-name: fade;
animation-iteration-count: infinite;
animation-duration: 1s;
animation-direction: alternate;
}
#keyframes fade {
0% {
opacity: 1;
}
25% {
opacity: 1;
}
75% {
opacity: 0;
}
100% {
opacity: 0;
}
}
<section>
<img class="bottom" src="https://placeimg.com/640/480/nature">
<img class="top" src="https://placeimg.com/640/480/arch">
</section>
Codepen: https://codepen.io/Rhys_Eng/pen/NWdwxaO
To solve the issue with transparent images overlaying each other you can use your current technique to fade out the underlying image as the new one is displayed over it. To do that add a 1 second delay to its animation. Try this:
section img {
position: absolute;
width: 200px;
animation: fade 1s infinite alternate;
}
.bottom {
animation-delay: 1s;
}
#keyframes fade {
0% { opacity: 1; }
25% { opacity: 1; }
75% { opacity: 0; }
100% { opacity: 0; }
}
<section>
<img class="bottom" src="https://placeimg.com/640/480/nature">
<img class="top" src="https://placeimg.com/640/480/arch">
</section>
If you wanted to change the image without fading, while still using CSS alone, then you can amend the keyframes to this:
#keyframes fade {
0% { opacity: 1; }
49% { opacity: 1; }
50% { opacity: 0; }
100% { opacity: 0; }
}
I've made a small Image animation where images changes opacity over time.It works smoothly but when last image gets to 100% it jumps straight to 0% without any transition.
I have already tried animation-direction: alternate for third image and delay for all image but it does not work for me. Delay works only first step of animation cycle after it delay becomes 0 for all.
Here is my CSS
.rightside .img-container img.first {
animation-name: first-image;
animation-duration: 9s;
animation-fill-mode: both;
animation-iteration-count: infinite;
/* animation-delay: -10s; */
}
.rightside .img-container img.second {
position: absolute;
top: 0;
animation-name: second-image;
animation-duration: 9s;
animation-fill-mode: both;
animation-iteration-count: infinite;
}
.rightside .img-container img.third {
position: absolute;
top: 0;
animation-name: final-image;
animation-duration: 9s;
animation-fill-mode: both;
animation-iteration-count: infinite;
animation-timing-function: linear;
/* animation-direction: alternate; */
}
#keyframes first-image {
0% {
opacity: 0;
}
33.3% {
opacity: 1;
}
67% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#keyframes second-image {
0% {
opacity: 0;
}
33.3% {
opacity: 0;
}
67% {
opacity: 1;
}
100% {
opacity: 0;
}
}
#keyframes final-image {
0% {
opacity: 0;
}
33.3% {
opacity: 0;
}
67% {
opacity: 0;
}
100% {
opacity: 1;
}
}
HTML
<div class="img-container">
<img src="Images/Apple.png" class="first turn" alt="Image Here" />
<img src="Images/Bee.png" class="second" alt="Image Here" />
<img src="Images/Cat.png" class="third" alt="Image Here" />
</div>
The clasical aproach to this would be just using different delays:
div {
animation-name: all;
animation-duration: 9s;
animation-iteration-count: infinite;
width: 100px;
height: 100px;
background-color: yellow;
}
.first {
animation-delay: -3s;
background-color: lightgreen;
}
.third {
animation-delay: -6s;
background-color: lightblue;
}
#keyframes all {
0% {
opacity: 0;
}
33.3% {
opacity: 1;
}
67% {
opacity: 0;
}
100% {
opacity: 0;
}
}
<div class="first"></div>
<div class="second"></div>
<div class="third"></div>
There are two images, first is the boat, second the plane. The desired result is: Boat animates from left to right, at that time the plane is hidden. When the boat reaches the middle of the screen it disappears and the plane appears. This change should happen smoothly.
.image1 {
width: 259px;
height: 259px;
display: block;
position: absolute;
bottom: 135px;
margin: auto;
#include transition(all 1.2s);
background-size: contain;
-webkit-animation: helicopter-move-one 19s linear infinite;
animation: helicopter-move-one 19s linear infinite;
opacity: 1;
}
#-webkit-keyframes helicopter-move-one {
0% {
left: -300px;
}
60% {
opacity: 0;
}
100% {
left: 110%;
}
}
#keyframes helicopter-move-one {
0% {
left: -300px;
display: block;
}
59% {
display: none;
}
60% {
display: none;
}
100% {
left: 110%;
}
}
<div class="outer">
<div class="image1"><img src="" alt="boat"></div>
<div class="image2"><img src="" alt="plane"></div>
</div>
Since I don't have your images I'm using dogs. In this case "The desired result is: adult dog animates from left to right, at that time the puppy is hidden. When adult dog reaches the middle of the screen it disappears and the puppy appears. This change should happen smoothly." Please note that display is not animatable. You need to animate the opacity instead.
img {
width: 150px;
height: 150px;
}
[class ^="image"] {
width: 150px;
height: 150px;
display: block;
position: absolute;
left: 0;
right: 0;
background-size: contain;
}
.image1 {
z-index: 2;
animation: daAnimation1 19s linear infinite;
}
.image2 {
z-index: 1;
margin: auto;
left: 0;
right: 0;
opacity: 0;
animation: daAnimation2 19s linear infinite;
}
#keyframes daAnimation1 {
0% {
left: -150px;
opacity: 1;
}
45% {
left: calc(50vw - 75px);
opacity: 1;
}
50% {
left: calc(50vw - 75px);
opacity: 0;
}
100% {
left: 110%;
opacity: 0;
}
}
#keyframes daAnimation2 {
0% {
opacity: 0;
}
45% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 1;
}
}
<div class="outer">
<div class="image1"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/222579/darwin300.jpg" alt="adult dog"></div>
<div class="image2"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/222579/puppyBeagle300.jpg" alt="puppy"></div>
</div>
I hope this answers your question.
UPDATE:this is an answer to #Danish comment (see below)
img {
width: 150px;
height: 150px;
}
[class ^="image"] {
position:absolute;
background-size: contain;
}
.image1 {
z-index: 2;
opacity: 1;
animation: daAnimation1 19s linear infinite;
}
.image2 {
z-index: 1;
opacity: 1;
}
.outer{
width: 150px;
height: 150px;
display: block;
position: absolute;
animation: OuterAnimation 19s linear infinite;
}
#keyframes OuterAnimation{
0% {
left: -150px;
}
100% {
left: 110%;
}
}
#keyframes daAnimation1 {
0% {
opacity: 1;
}
45% {
opacity: 1;
}
50% {
opacity: 0;
}
100% {
opacity: 0;
}
}
<div class="outer">
<div class="image1"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/222579/darwin300.jpg" alt="adult dog"></div>
<div class="image2"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/222579/puppyBeagle300.jpg" alt="puppy"></div>
</div>
I tried to put a "float:right" in the .skill_item_colored_main_wrap part. but it became such a mess. I think it has something to do with -webkit-animation part.
how can i modify it so it will transit from right to left?
.shortcode_skill {
position:relative;
overflow:hidden;
}
.shortcode_skill:before {
position:absolute;
top:0;
left:27%;
margin:15px 0 0;
width:1px;
height:95%;
background:rgba(0, 0, 0, .1);
content:"";
}
.skill_item {
overflow:hidden;
width:100%;
}
.skill_item > span {
float:left;
padding:24px 4.7% 0 0;
width:25%;
text-align:right;
}
.skill_item_colored_main_wrap {
float:left;
padding:15px 0 5px;
width:70%;
}
.skill_item_colored_wrap {
position:relative;
height:33px;
}
.skill_item_colored {
position:absolute;
width:100%;
height:100%;
-webkit-animation:move 2s linear .1s normal none 1 ;
-moz-animation:move 2s linear .1s normal none 1 ;
-ms-animation:move 2s linear .1s normal none 1 ;
-o-animation:move 2s linear .1s normal none 1 ;
animation:move 2s linear .1s normal none 1 ;
}
#-webkit-keyframes move {
from {width:0;}
to {width:100%;}
}
#-ms-keyframes move {
from {width:0;}
to {width:100%;}
}
#-o-keyframes move {
from {width:0;}
to {width:100%;}
}
#keyframes move {
from {width:0;}
to {width:100%;}
}
.skill_item_colored_wrap > span {
position:relative;
display:block;
}
.skill_item_colored > span {
display:block;
padding:8px 10px;
text-align:right;
-webkit-animation:opacity 2.5s linear .1s normal none 1 ;
-moz-animation:opacity 2.5s linear .1s normal none 1 ;
-ms-animation:opacity 2.5s linear .1s normal none 1 ;
-o-animation:opacity 2.5s linear .1s normal none 1 ;
animation:opacity 2.5s linear .1s normal none 1 ;
}
#-webkit-keyframes opacity {
0% {opacity:0;}
90% {opacity:0;}
100% {opacity:1;}
}
#-moz-keyframes opacity {
0% {opacity:0;}
90% {opacity:0;}
100% {opacity:1;}
}
#-ms-keyframes opacity {
0% {opacity:0;}
90% {opacity:0;}
100% {opacity:1;}
}
#-o-keyframes opacity {
0% {opacity:0;}
90% {opacity:0;}
100% {opacity:1;}
}
#keyframes opacity {
0% {opacity:0;}
90% {opacity:0;}
100% {opacity:1;}
}
<div class="skill_item">
<span>hello world </span>
<div class="skill_item_colored_main_wrap">
<div class="skill_item_colored_wrap" style="width:95%;">
<div class="skill_item_colored" style="background-color:#f97a14;">
<span>95%</span>
</div>
</div>
</div>
</div>
A quick and easy way to do this would be to rotate the parent element 180deg and then rotate the child element negative -180deg.
Assuming you want the text aligned to the left, I added text-align: left. Omit that if you want it aligned to the right.
.skill_item_colored_wrap {
transform: rotate(180deg);
}
.skill_item_colored_wrap .skill_item_colored > span {
text-align: left;
transform: rotate(-180deg);
}
.skill_item_colored_wrap {
transform: rotate(180deg);
}
.skill_item_colored_wrap .skill_item_colored > span {
text-align: left;
transform: rotate(-180deg);
}
.shortcode_skill {
position: relative;
overflow: hidden;
}
.shortcode_skill:before {
position: absolute;
top: 0;
left: 27%;
margin: 15px 0 0;
width: 1px;
height: 95%;
background: rgba(0, 0, 0, .1);
content: "";
}
.skill_item {
overflow: hidden;
width: 100%;
}
.skill_item > span {
float: left;
padding: 24px 4.7% 0 0;
width: 25%;
text-align: right;
}
.skill_item_colored_main_wrap {
float: left;
padding: 15px 0 5px;
width: 70%;
}
.skill_item_colored_wrap {
position: relative;
height: 33px;
}
.skill_item_colored {
position: absolute;
width: 100%;
height: 100%;
-webkit-animation: move 2s linear .1s normal none 1;
-moz-animation: move 2s linear .1s normal none 1;
-ms-animation: move 2s linear .1s normal none 1;
-o-animation: move 2s linear .1s normal none 1;
animation: move 2s linear .1s normal none 1;
}
#-webkit-keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
#-ms-keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
#-o-keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
#keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
.skill_item_colored_wrap > span {
position: relative;
display: block;
}
.skill_item_colored > span {
display: block;
padding: 8px 10px;
text-align: right;
-webkit-animation: opacity 2.5s linear .1s normal none 1;
-moz-animation: opacity 2.5s linear .1s normal none 1;
-ms-animation: opacity 2.5s linear .1s normal none 1;
-o-animation: opacity 2.5s linear .1s normal none 1;
animation: opacity 2.5s linear .1s normal none 1;
}
#-webkit-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-moz-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-ms-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-o-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
<div class="skill_item">
<span>hello world </span>
<div class="skill_item_colored_main_wrap">
<div class="skill_item_colored_wrap" style="width:95%;">
<div class="skill_item_colored" style="background-color:#f97a14;">
<span>95%</span>
</div>
</div>
</div>
</div>
As an alternative, you could also set direction: rtl on the .skill_item element, and then set the .skill_item_colored_main_wrap element's display to inline-block and remove float: left:
.skill_item {
overflow: hidden;
width: 100%;
direction: rtl;
}
.skill_item_colored_main_wrap {
display: inline-block;
}
.skill_item {
overflow: hidden;
width: 100%;
direction: rtl;
}
.skill_item_colored_main_wrap {
display: inline-block;
}
.shortcode_skill {
position: relative;
overflow: hidden;
}
.shortcode_skill:before {
position: absolute;
top: 0;
left: 27%;
margin: 15px 0 0;
width: 1px;
height: 95%;
background: rgba(0, 0, 0, .1);
content: "";
}
.skill_item > span {
float: left;
padding: 24px 4.7% 0 0;
width: 25%;
}
.skill_item_colored_main_wrap {
padding: 15px 0 5px;
width: 70%;
}
.skill_item_colored_wrap {
position: relative;
height: 33px;
}
.skill_item_colored {
position: absolute;
width: 100%;
height: 100%;
-webkit-animation: move 2s linear .1s normal none 1;
-moz-animation: move 2s linear .1s normal none 1;
-ms-animation: move 2s linear .1s normal none 1;
-o-animation: move 2s linear .1s normal none 1;
animation: move 2s linear .1s normal none 1;
}
#-webkit-keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
#-ms-keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
#-o-keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
#keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
.skill_item_colored_wrap > span {
position: relative;
display: block;
}
.skill_item_colored > span {
display: block;
padding: 8px 10px;
text-align: right;
-webkit-animation: opacity 2.5s linear .1s normal none 1;
-moz-animation: opacity 2.5s linear .1s normal none 1;
-ms-animation: opacity 2.5s linear .1s normal none 1;
-o-animation: opacity 2.5s linear .1s normal none 1;
animation: opacity 2.5s linear .1s normal none 1;
}
#-webkit-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-moz-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-ms-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-o-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
<div class="skill_item">
<span>hello world </span>
<div class="skill_item_colored_main_wrap">
<div class="skill_item_colored_wrap" style="width:95%;">
<div class="skill_item_colored" style="background-color:#f97a14;">
<span>95%</span>
</div>
</div>
</div>
</div>
Here an alternative,
<div class="progress">
<div class="progress-bar progress-bar-info" role="progressbar" style="width:95%%;"></div>
</div>
And add this to your CSS
.progress-middle .progress-bar {
position: relative;
}
.progress-right .progress-bar {
float: right;
}
What we did here is make sure the position is relative then float the progress-bar to right instead of left.