Why does Firefox replay css animations in reverse? - html

As shown in the codepen below, the nav a links fade in as they should, but then when hovered they seem to replay the animation in reverse and then forward again really quickly. It's really odd. http://codepen.io/mildrenben/pen/wBMVdm
<header>
<h1>BEN MILDREN</h1>
<p>Designer and Developer</p>
</header>
<nav>
<a>About</a>
<a>Portfolio</a>
<a>Blog</a>
<a>Contact</a>
</nav>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600,300,700,800|Gentium+Book+Basic:400,400italic,700italic' rel='stylesheet' type='text/css'>
CSS:
html, body {
width: 100%;
height: 100%;
}
body {
background: url(https://ununsplash.imgix.net/reserve/D9xlw7UxTBqQw5sLf8cJ_reef%20insp-72.jpg?q=75&fm=jpg&s=a46f72e373f7af2b3bba993f565e24be);
background-size: cover;
}
* {
margin: 0;
}
$color: #4C5C58;
$color-light: #5B6B67;
header {
position: absolute;
top: 27%;
left: calc(50% - 182px);
text-align: center;
-webkit-animation: anim2 1s ease-in-out 2.5s forwards;
}
#-webkit-keyframes anim1 {
100% {
transform: translateY(-12px);
opacity: 1;
}
}
#-webkit-keyframes anim2 {
100% {
transform: translateY(-70px);
}
}
#keyframes anim1 {
100% {
transform: translateY(-12px);
opacity: 1;
}
}
#keyframes anim2 {
100% {
transform: translateY(-70px);
}
}
h1 {
font-family: 'Open Sans', sans-serif;
font-size: 56px;
font-weight: 800;
color: $color;
opacity: 0;
-webkit-animation: anim1 1.5s ease-in-out forwards;
animation: anim1 1.5s ease-in-out forwards;
}
p {
font-family: 'Gentium Book Basic', serif;
font-style: italic;
font-size: 20px;
color: $color-light;
opacity: 0;
-webkit-animation: anim1 1.5s ease-in-out 0.3s forwards;
}
nav {
position: absolute;
left: calc(50% - 183px);
top: 45%;
}
a {
height: 40px;
width: auto;
background: none;
margin: 0 20px;
border: none;
cursor: pointer;
font-family: 'Gentium Book Basic', sans-serif;
font-weight: 500;
font-size: 15px;
color: $color-light;
transition: all 0.3s ease-in-out;
line-height: 50px;
opacity: 0;
display: inline-block;
}
a:hover {
border-bottom: double 3px $color-light;
}
img {
width: 150px;
position: absolute;
margin-left: 72px;
top: 38px;
}
nav p {
font-style: italic;
font-size: 14px;
position: absolute;
top: 80px;
left: 100px;
}
a:nth-of-type(1) {
-webkit-animation: anim1 1s ease-in-out 3s forwards;
animation: anim1 1s ease-in-out 3s forwards;
}
a:nth-of-type(2) {
-webkit-animation: anim1 1s ease-in-out 3.1s forwards;
animation: anim1 1s ease-in-out 3.1s forwards;
}
a:nth-of-type(3) {
-webkit-animation: anim1 1s ease-in-out 3.2s forwards;
animation: anim1 1s ease-in-out 3.2s forwards;
}
a:nth-of-type(4) {
-webkit-animation: anim1 1s ease-in-out 3.3s forwards;
animation: anim1 1s ease-in-out 3.3s forwards;
}

Related

Fade in chars in css with an loop

so i want to fade in letter by letter using only css.
:root {
--delay: 1;
}
#welcomemsg span {
visibility: hidden;
}
#welcomemsg span:nth-of-type(n+1) {
animation: type 0s ease-in var(--delay)s;
animation-fill-mode: forwards;
--delay: calc(var(--delay) + 1);
}
#keyframes type {
to {
visibility: unset;
}
}
<div id="welcomemsg">
<span>H</span><span>e</span><span>y</span><span>!</span>
</div>
I did some research and found out that this couldnt work bc the delay would be inside an loop so :nth-of-type(1) delay would be infinite. Is there an way to get this working without doing all nth-of-types by hand ? It would be so cool to do this without creating an css mess.
Here you go...
#welcomemsg {
color: red;
font-family: "Courier";
font-size: 20px;
margin: 10px 0 0 10px;
white-space: nowrap;
overflow: hidden;
width: 30em;
animation: type 20s steps(50, end);
}
#keyframes type {
from {
width: 0;
}
}
<div id="welcomemsg">
<span>H</span><span>e</span><span>y</span><span>!</span>
</div>
UPDATE
span {
font-size: 30px;
opacity: 0;
}
span:nth-child(1) {
animation: type 1s forwards 0s;
}
span:nth-child(2) {
animation: type 1s forwards 0.5s;
}
span:nth-child(3) {
animation: type 1s forwards 1s;
}
span:nth-child(4) {
animation: type 1s forwards 1.5s;
}
#keyframes type {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
<div id="welcomemsg">
<span>H</span><span>e</span><span>y</span><span>!</span>
</div>

increasing the height of particular bar in vertical bar chart

I am using a vertical bar chart from the site::
https://codepen.io/anythinggraphic/pen/xxKpBax
/* Bar Graph Vertical */
.bar-graph .year {
-webkit-animation: fade-in-text 2.2s 0.1s forwards;
-moz-animation: fade-in-text 2.2s 0.1s forwards;
animation: fade-in-text 2.2s 0.1s forwards;
}
.bar-graph-vertical {
margin-top: -109px;
max-width: 680px;
}
.bar-graph-vertical .bar-container {
float: left;
height: 150px;
margin-right: 8px;
position: relative;
text-align: center;
width: 40px;
}
.bar-graph-vertical .bar {
border-radius: 3px;
bottom: 40px;
position: absolute;
width: 40px;
}
.bar-graph-vertical .year {
bottom: 0;
left: 0;
margin: 0 auto;
position: absolute;
right: 0;
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
.bar-graph-two .bar::after {
-webkit-animation: fade-in-text 2.2s 0.1s forwards;
-moz-animation: fade-in-text 2.2s 0.1s forwards;
animation: fade-in-text 2.2s 0.1s forwards;
color: #fff;
content: attr(data-percentage);
font-weight: 700;
left: 0;
margin: 0 auto;
position: absolute;
right: 0;
text-align: left;
top: 24px;
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
.bar-graph-two .bar-one .bar {
background-color: #64b2d1;
-webkit-animation: show-bar-one-vertical 1.2s 0.1s forwards;
-moz-animation: show-bar-one-vertical 1.2s 0.1s forwards;
animation: show-bar-one-vertical 1.2s 0.1s forwards;
}
.bar-graph-two .bar-two .bar {
background-color: #5292ac;
-webkit-animation: show-bar-two-vertical 1.2s 0.2s forwards;
-moz-animation: show-bar-two-vertical 1.2s 0.2s forwards;
animation: show-bar-two-vertical 1.2s 0.2s forwards;
}
.bar-graph-two .bar-three .bar {
background-color: #407286;
-webkit-animation: show-bar-three-vertical 1.2s 0.3s forwards;
-moz-animation: show-bar-three-vertical 1.2s 0.3s forwards;
animation: show-bar-three-vertical 1.2s 0.3s forwards;
}
.bar-graph-two .bar-four .bar {
background-color: #2e515f;
-webkit-animation: show-bar-four-vertical 1.2s 0.4s forwards;
-moz-animation: show-bar-four-vertical 1.2s 0.4s forwards;
animation: show-bar-four-vertical 1.2s 0.4s forwards;
}
I have posted the CSS code block from the site but please refer to the site.
I have to increase the height of a particular bar labelled "2017". I am unable to do that. I tried with inspect element but can't do it. Please can any one help me with this. Thank You!!!
there are two ways:
1)inline css on line 109
100% {
height: 108%;
}
or
2)
<div class="bar" data-percentage="68%" style="height: 120% !important;"></div>
if you use and fill data-percentage on your server side, you could also fill a css var() value meanwhile and use that var to update size and label from CSS.
Writing-mode is also an option to rotate your text.
example
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
--bar: clamp(220px, 40vh, 500px);/* whatever you need here */
min-height:100vh;/*demo purpose */
display:flex;/*demo purpose */
}
body{margin:auto;/*demo purpose */}
ul {
font-size:clamp(10px, 4vmin, 16px);/* whatever you need here */
height: var(--bar);
display: flex;
align-items: end;
padding-top:0.5em;
padding-bottom: 4em;
width:max-content;/*demo purpose */
margin:auto;/*demo purpose */
background:#bee;
border-radius:0.25em;
box-shadow:0 0 5px;/*demo purpose */
transition: 0.2s
}
ul:hover {transform:rotate(-90deg);/*demo purpose */}
li {
width:2em;
writing-mode: vertical-lr;
margin: 0 0.5em;
display: flex;
align-items: center;
animation: show-bar-vertical 1.2s 0.4s forwards;
}
b {
margin-bottom: -4em;
padding:0.5em;
background:#adf
}
span {
padding: 0 0.5em;
flex: 1 1;
border-radius: 0.25em;
margin-bottom: 0.25em;
overflow:hidden;
max-height:0;
box-shadow:1px 1px 2px white,-1px -1px 2px gray;
animation:delay 0.1s 0.25s forwards
}
span:before {
content: attr(data-percentage);
display: inline-block;
color: white;
text-indent: .5em;
height:0;
}
li:nth-child(odd) b {background:#aef;}
li:nth-child(1) span {
background-color: #64b2d1;
}
li:nth-child(2) span {
background-color: #5292ac;
}
li:nth-child(3) span {
background-color: #407286;
}
li:nth-child(4) span {
background-color: #2e515f;
}
li:nth-child(5) span {
background-color: #1e3d49;
}
#keyframes show-bar-vertical {
0% {
height: 0;
}
100% {
height: var(--data-percentage,auto);
}
}
#keyframes delay{
to {max-height:100%;}
}
<!-- example build from a list, structure can be anything else -->
<ul id="bargraph">
<li style="--data-percentage : 40% ">
<span data-percentage=" 40%" ></span>
<b>2020</b>
</li>
<li style="--data-percentage : 55% ">
<span data-percentage=" 55%" ></span>
<b>2019</b>
</li>
<li style="--data-percentage : 100% " >
<span data-percentage=" 100%" ></span>
<b>2018</b>
</li>
<li style="--data-percentage : 82% ">
<span data-percentage=" 82%" ></span>
<b>2017</b>
</li>
<li style="--data-percentage : 25% ">
<span data-percentage=" 25%" ></span>
<b>2016</b>
</li>
</ul>

CSS Typing Effect

I'm trying to achieve a typing effect with multiple lines in CSS.
This was a good reference point I followed:
CSS animated typing
https://css-tricks.com/snippets/css/typewriter-effect/
Now my desired effect is that the first border-right's visibility be hidden once the first blinking cursor's animation ends. A the border-right is still on screen after the animation ends and I want it not to be visible. (As if enter button on a keyboard was pressed.) How would I go about that?
https://jsfiddle.net/6567onn8/5/
.typewriter h1 {
text-align: center;
overflow: hidden;
font-size: 100%;
border-right: .15em solid #fff;
white-space: nowrap;
/* keeps content in one line */
letter-spacing: .15em;
animation: typing 2.5s steps(22, end), blink-caret .75s step-end;
}
.typewriter h2 {
font-size: 100%;
white-space: nowrap;
overflow: hidden;
border-right: .15em solid black;
-webkit-animation: typing 2s steps(26, end), blink-caret 1s step-end infinite;
-webkit-animation-delay: 3s;
-webkit-animation-fill-mode: both;
-moz-animation: typing 2s steps(26, end), blink-caret 1s step-end infinite;
-moz-animation-delay: 3s;
}
/* The typing effect */
#keyframes typing {
from {
width: 0
}
to {
width: 9em;
}
}
#keyframes blink-caret {
from, to {
border-color: transparent
}
50% {
border-color: #000;
}
}
<div class="typewriter">
<h1>Hi. I'm Andy.</h1>
<h2>I love learning.</h2>
</div>
Just take out infinite
.typewriter h1 {
text-align: center;
overflow: hidden;
font-size: 100%;
border-right: .15em solid #fff;
white-space: nowrap;
/* keeps content in one line */
letter-spacing: .15em;
animation: typing 2.5s steps(22, end), blink-caret .75s step-end;
}
.typewriter h2 {
font-size: 100%;
white-space: nowrap;
overflow: hidden;
border-right: .15em solid black;
-webkit-animation: typing 2s steps(26, end), blink-caret 1s step-end;
-webkit-animation-delay: 3s;
-webkit-animation-fill-mode: both;
-moz-animation: typing 2s steps(26, end), blink-caret 1s step-end;
-moz-animation-delay: 3s;
}
/* The typing effect */
#keyframes typing {
from {
width: 0
}
to {
width: 9em;
}
}
#keyframes blink-caret {
from, to {
border-color: transparent
}
50% {
border-color: #000;
}
}
<div class="typewriter">
<h1>Hi. I'm Andy.</h1>
<h2>I love learning.</h2>
</div>
body{
margin: 0;
font-family: 'Pacifico', cursive;
}
.blackboard-wrapper {
width: 100vw;
height: 100vh;
background-image: repeating-linear-gradient(to bottom,#26180B 70%,#362418 77%,#77736A 78%,#655444 78%);
}
.black-board {
height: 360px;
width: 800px;
transform: translateY(70px);
margin: 0 auto;
background-image: repeating-linear-gradient(to bottom,#000000 77%,#111111 78%,#222222 77%,#000000 78%);
border-width: 15px;
border-style: groove;
border-color: #2E1E11;
position: relative;
color: #ffffff;
}
.date {
position: absolute;
left: 15px;
top: 10px;
}
.date > span {
display: block;
margin-bottom: 5px;
}
.black-board::before {
position: absolute;
left: 0;
content: "";
right: 0;
background-color: #afafaf;
height: 2px;
top: 94px;
}
.topic {
position: absolute;
top: 28px;
left: 50%;
transform: translateX(-50%);
text-decoration: underline;
word-spacing: 8px;
}
.writing {
position: absolute;
top: 120px;
left: 15px;
right: 15px;
bottom: 15px;
}
.writing::after,
.writing::before {
position: absolute;
letter-spacing: 2px;
font-size: 30px;
animation-name: write;
animation-duration: 5s;
animation-iteration-count: infinite;
animation-timing-function: cubic-bezier(.7,.45,.97,.36);
}
.writing::before{
font-size: 25px;
content:"This is cool NAAA???";
top: 70px;
color: #1FBEA6;
animation-name: write2;
animation-duration: 2s;
animation-iteration-count: 1;
animation-timing-function: cubic-bezier(.7,.45,.97,.36);
}
#keyframes write{
0%{content:"";}
3%{content:"V_";}
6%{content:"VI_";}
9%{content:"VIK_";}
12%{content:"VIKA_";}
15%,25%{content:"VIKAS";}
28%{content:"VIKA_";}
31%{content:"VIK_";}
34%{content:"VI_";}
37%{content:"V_";}
40%,50%{content:"";}
53%{content:"P_";}
56%{content:"PA_";}
59%{content:"PAT_";}
62%{content:"PATE_";}
65%,75%{content:"PATEL";}
78%{content:"PATE_";}
81%{content:"PAT_";}
84%{content:"PA_";}
88%{content:"P_";}
91%,100%{content:"";}
}
#keyframes write2{
0%{content:"";}
5%{content:"T_";}
10%{content:"Th_";}
15%{content:"Thi_";}
20%{content:"This_ ";}
25%{content:"This i_";}
30%{content:"This is_";}
35%{content:"This is_ ";}
40%{content:"This is c_";}
45%{content:"This is co_";}
50%{content:"This is coo_";}
55%{content:"This is cool_";}
65%{content:"This is cool N_";}
70%{content:"This is cool NA_";}
75%{content:"This is cool NAA_";}
80%{content:"This is cool NAAA";}
85%{content:"This is cool NAAA?";}
90%{content:"This is cool NAAA??";}
95%{content:"This is cool NAAA???";}
100%{content:"This is cool NAAA???";}
}
<link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet">
<div class="blackboard-wrapper">
<div class="black-board">
<div class="date">
<span>DATE</span>
<span>25|oct|2018</span>
</div>
<div class="topic">TYPING EFFECT USING CSS</div>
<div class="writing"></div>
</div>
</div>
https://codepen.io/Vikaspatel/pen/mzarrO
.wrapper {
height: 100vh;
/*This part is important for centering*/
display: flex;
align-items: center;
justify-content: center;
}
.typing-demo {
width: 22ch;
animation: typing 2s steps(22), blink .5s step-end infinite alternate;
white-space: nowrap;
overflow: hidden;
border-right: 3px solid;
font-family: monospace;
font-size: 2em;
}
#keyframes typing {
from {
width: 0
}
}
#keyframes blink {
50% {
border-color: transparent
}
}
<div class="wrapper">
<div class="typing-demo">
This is a typing demo.
</div>
</div>
Easiest way of doing it in CSS.

animated photo banner resets instead of repeating the first image css

I got this banner thingy from a tutorial, but the thing is, instead of the banner continuing in loops, it resets instead. I don't want to use any javascript since we we're not yet tackling it in uni. Can anyone point out where I did wrong and how to fix it? Thanks.
Here are the images:
[1]
[2]
and this is the code I used
HTML:
<div class="photobanner">
<img class="first" src="images/scroll/ban.jpg" style="width:350px;height:233px;"/>
<img src="images/scroll/banner1.png" style="width:350px;height:233px;"/>
<img src="images/scroll/banner3.jpg" style="width:350px;height:233px;"/>
<img src="images/scroll/banner4.jpg" style="width:350px;height:233px;"/>
<img src="images/scroll/banner5.jpg" style="width:350px;height:233px;"/>
</div>
</div>
CSS:
/*body and container*/
* {
margin: 0;
padding: 0;
}
body {
background-image:url(images/banner1takuya.jpg);
background-size: cover;
background-attachment: fixed;
}
#container {
width:865px;
height:auto;
margin:auto;
padding:0 0 30px 0;
background-image:url(images/bg.png);
}
/*header*/
header {
width: 800px;
margin: 40px auto;
}
header h1 {
text-align: center;
font: 100 60px/1.5 Helvetica, Verdana, sans-serif;
}
header p {
font: 100 15px/1.5 Helvetica, Verdana, sans-serif;
text-align: justify;
}
/*photobanner*/
.photobanner {
height: 233px;
width: 3550px;
margin-bottom: 80px;
}
.photobanner img {
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.photobanner img:hover {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-o-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
cursor: pointer;
-webkit-box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
}
/*keyframe animations*/
.first {
-webkit-animation: bannermove 30s linear infinite;
-moz-animation: bannermove 30s linear infinite;
-ms-animation: bannermove 30s linear infinite;
animation: bannermove 30s linear infinite;
}
#keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
#-moz-keyframes bannermove {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
#-webkit-keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
#-ms-keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
#-o-keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
You have the .photobanner width set to 3550px, but the sum of images' widths is 355*5=1775px only.
You need to add 5 more images of the same size and this will work correctly.

Move Image across using CSS3 animation

I am trying to slide an image across the screen and then stay at a fixed point. I have looked online and found a few variants on what I have but nothing seems to work.
Have a look at this fiddle.
http://jsfiddle.net/lharby/ysgzpuer/
I had to pass in
-webkit-animation: mini 2s normal;
-moz-animation: mini 3s normal;
-o-animation: mini 3s normal;
animation: mini 2s normal;
to the .mini class to animate the div.
Update: This also has the opacity animated:
http://jsfiddle.net/lharby/ysgzpuer/1/
By editing:
#-webkit-keyframes mini {
from {
left:0px;
opacity:0;
}
to{
left:404px;
opacity:1;
}
#-webkit-keyframes mini {
from {
left:-166px;
}
}
.mini {
background-image: url("http://placehold.it/150x150");
position: absolute;
top: 10px;
left: 404px;
width: 166px;
height: 70px;
z-index: 7;
-webkit-animation: mini 2s linear;
}
<div class=mini></div>
Or this if you don't have overflow: hidden on the parent to avoid the scrollbar
#-webkit-keyframes mini {
from {
left:0px;
-webkit-transform: translateX(-166px)
}
}
.mini {
background-image: url("http://placehold.it/150x150");
position: absolute;
top: 10px;
left: 404px;
width: 166px;
height: 70px;
z-index: 7;
-webkit-animation: mini 2s linear;
}
<div class=mini></div>
this will keep the last frame of the animation after its done
animation-fill-mode: forwards;
#-webkit-keyframes mini {
from{
opacity:0;
}
to{
opacity:1;
}
from {
left:0px;
}
to{
left:404px;
}
}
.frame1 {
-webkit-animation: mini 2s normal forwards;
-moz-animation: mini 30s normal forwards;
-o-animation: mini 30s normal forwards;
animation: mini 2s normal forwards;
opacity:1;
}
.mini {
background-image: url("http://blog.grio.com/wp-content/uploads/2012/09/stackoverflow.png");
position: absolute;
top: 10px;
left: -404px;
width: 166px;
height: 70px;
z-index: 7;
}
<div class="frame1 mini">
</div>
hope this is what you are looking for
Html
<div class="stage">
<figure class="ball"></figure>
</div>
CSS
#keyframes slide {
0% {
left: 0;
top: 0;
}
100% {
left: 488px;
top: 0;
}
}
.stage {
background: #eaeaed;
border-radius: 6px;
height: 150px;
position: relative;
min-width: 538px;
}
.stage:hover .ball {
animation-name: slide;
animation-duration: 2s;
animation-timing-function: ease-in-out;
animation-delay: .5s;
animation-fill-mode: forwards;
}
.stage:active .ball {
animation-play-state: paused;
}
.ball {
background: #2db34a;
border-radius: 50%;
height: 50px;
position: absolute;
width: 50px;
}
Fiddle Demo