I am trying to animate first letter of a text with pseudo element selector. However it's not working. The code is working fine if I wrape the first letter in span but it's not working with pseudo element selector (::first-letter).
div.w-text-h a.w-text-value{display:block;}
div.w-text-h a.w-text-value::first-letter{
top: 50%;
right: 50%;
transform: translate(50%,-50%);
text-transform: uppercase;
font-family: verdana;
font-size: 50px;
font-weight: 700;
color: #f5f5f5;
-webkit-animation-name: example;
-webkit-animation-duration: 4s;
animation-name: example;
animation-duration: 4s;
text-shadow: 1px 1px 1px #5DADE2,
1px 2px 1px #5DADE2,
1px 3px 1px #5DADE2,
1px 4px 1px #5DADE2,
1px 5px 1px #5DADE2,
1px 6px 1px #5DADE2,
1px 7px 1px #5DADE2,
1px 8px 1px #5DADE2,
1px 9px 1px #5DADE2,
1px 10px 1px #5DADE2,
1px 18px 6px rgba(16,16,16,0.4),
1px 22px 10px rgba(16,16,16,0.2),
1px 25px 35px rgba(16,16,16,0.2),
1px 30px 60px rgba(16,16,16,0.4);
}
div.w-text-h a.w-text-value::first-letter{animation:animated_div 5s infinite;
-moz-animation:animated_div 5s infinite;
-webkit-animation:animated_div 5s infinite;
border-radius:5px;
-webkit-border-radius:5px;
transform-style: preserve-3d;}
#keyframes animated_div
{
0% {}
20% {transform: rotateY(20deg);}
40% {transform: rotateY(40deg);}
60% {transform: rotateY(60deg);}
80% {transform: rotateY(80deg);}
100% {transform: rotateY(100deg);}
}
<div class="w-text-h"><a class="w-text-value" href="http://localhost/Developer/">Developer</a></div>
If I remove pseudo element first-letter, then animation works. I need it on pseudo element first-letter
You can't apply transform to ::first-letter (check properties list). But you can have different wrapper for it, then it's possible. You can use some JS to wrap first letter too.
div.w-text-h a.w-text-value{display:block;}
div.w-text-h a.w-text-value .first-letter{
display: inline-block;
top: 50%;
right: 50%;
transform: translate(50%,-50%);
text-transform: uppercase;
font-family: verdana;
font-size: 50px;
font-weight: 700;
color: #f5f5f5;
-webkit-animation-name: example;
-webkit-animation-duration: 4s;
animation-name: example;
animation-duration: 4s;
text-shadow: 1px 1px 1px #5DADE2,
1px 2px 1px #5DADE2,
1px 3px 1px #5DADE2,
1px 4px 1px #5DADE2,
1px 5px 1px #5DADE2,
1px 6px 1px #5DADE2,
1px 7px 1px #5DADE2,
1px 8px 1px #5DADE2,
1px 9px 1px #5DADE2,
1px 10px 1px #5DADE2,
1px 18px 6px rgba(16,16,16,0.4),
1px 22px 10px rgba(16,16,16,0.2),
1px 25px 35px rgba(16,16,16,0.2),
1px 30px 60px rgba(16,16,16,0.4);
}
div.w-text-h a.w-text-value .first-letter{animation:animated_div 5s infinite;
-moz-animation:animated_div 5s infinite;
-webkit-animation:animated_div 5s infinite;
border-radius:5px;
-webkit-border-radius:5px;
transform-style: preserve-3d;}
#keyframes animated_div
{
0% {}
20% {transform: rotateY(20deg);}
40% {transform: rotateY(40deg);}
60% {transform: rotateY(60deg);}
80% {transform: rotateY(80deg);}
100% {transform: rotateY(100deg);}
}
<div class="w-text-h"><a class="w-text-value" href="http://localhost/Developer/"><span class="first-letter">D</span>eveloper</a></div>
Related
I have the following JS fiddle: https://jsfiddle.net/ur9bpgbn/163/
.arrow {
position: absolute;
font-size: 16px;
max-width: 350px;
background: #FFF;
height: 40px;
line-height: 40px;
margin-bottom: 20px;
text-align: center;
color: #000;
box-shadow: 3px 5px 5px rgba(0, 0, 0, 0.2);
visibility: hidden;
opacity: 0;
transition: visibility 0s, opacity 0.3s ease-in-out;
z-index: 999;
}
.arrow.active {
visibility: visible;
opacity: 1;
}
.arrow.active.animate-left-to-right {
animation-name: move-left-to-right;
animation-duration: 1s;
animation-delay: 0.6s;
animation-iteration-count: infinite;
animation-direction: alternative;
}
.arrow.active.animate-right-to-left {
animation-name: move-right-to-left;
animation-duration: 1s;
animation-delay: 0.6s;
animation-iteration-count: infinite;
animation-direction: alternative;
}
#keyframes move-left-to-right {
0% {
transform: translateX (5%);
box-shadow: 3px 5px 5px rgba(0, 0, 0, 0.2);
}
50% {
transform: translateX(15%);
box-shadow: 3px 5px 5px rgba(0, 0, 0, 0.4);
}
100% {
transform: translateX(5%);
box-shadow: 3px 5px 5px rgba(0, 0, 0, 0.2);
}
}
#keyframes move-right-to-left {
0% {
transform: translateX(-5%);
box-shadow: -3px 5px 5px rgba(0, 0, 0, 0.2);
}
50% {
transform: translateX(-15%);
box-shadow: -3px 5px 5px rgba(0, 0, 0, 0.4);
}
100% {
transform: translateX(-5%);
box-shadow: -3px 5px 5px rgba(0, 0, 0, 0.2);
}
}
/*right arrow*/
.arrow-right {
border-radius: 0px 0px 0 0px;
background: linear-gradient(to right, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.7));
}
.arrow-right:after {
content: "";
position: absolute;
right: -20px;
top: 0;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
border-left: 20px solid #FFF;
opacity: 0.7;
}
.arrow-right:before {
content: "";
position: absolute;
left: -20px;
top: 0;
border-top: 0px solid transparent;
border-bottom: 40px solid transparent;
border-right: 20px solid #FFF;
opacity: 1;
}
/*left arrow*/
.arrow-left {
border-radius: 0 0px 0px 0;
background: linear-gradient(to left, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.7));
}
.arrow-left:before {
content: "";
position: absolute;
left: -20px;
top: 0;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
border-right: 20px solid #FFF;
opacity: 0.7;
}
.arrow-left:after {
content: "";
position: absolute;
right: -20px;
top: 0;
border-top: 0px solid transparent;
border-bottom: 40px solid transparent;
border-left: 20px solid #FFF;
opacity: 1;
}
<div id="app">
<a href="https://sporedev.ro" target="_blank">
<div href="#" class="arrow arrow-right animate-right-to-left">This is a text</div>
</a>
<div href="#" class="arrow arrow-left animate-left-to-right" style="margin-top:30%; margin-left:30%;"><span class="room-desc">This is a text</span></div>
</div>
The arrow that moves to the right side works perfectly.
The arrow to the left side has some kind of a glitch, it has a sudden move when it reaches the end of the transition.
I tried applying changes to the CSS in everything related to the left arrow with no effect. The script has some JS that adds the "active" class and I tried removing it to simplify the script and make sure it's not a JS related problem with no effect.
Tried reading up transitions but I didn't found any solutions. I'm sure that I miss something that is CSS related.
How can I make the arrow that points to the left side move smoothly?
Update this part transform: translateX (5%); to transform: translateX (0%);
#keyframes move-left-to-right {
0% {
transform: translateX (0%);
box-shadow: 3px 5px 5px rgba(0, 0, 0, 0.2);
}
50% {
transform: translateX(15%);
box-shadow: 3px 5px 5px rgba(0, 0, 0, 0.4);
}
100% {
transform: translateX(0%);
box-shadow: 3px 5px 5px rgba(0, 0, 0, 0.2);
}
}
https://jsfiddle.net/ur9bpgbn/168/
I believe the little jump is the 0-5% which it is not animating so it just jumps
The code I use for my color changing header text (I also use this same code for my color changing button) creates an unwanted outline around the text in Chrome, but in other browsers (IE, Edge, Firefox) only the text appears (which is as intended).
I believe it might be because I am using the same code for the button as well as the header. But if that is the case, then I am not sure what is causing the code to behave differently in Chrome but okay in other browsers.
The site is uploaded here:
http://www.maximiles.co.uk/images/dynamics/uk/bilendiloyalty3/index.html
My codepen is here:
http://codepen.io/Dingerzat/pen/BQZGLe
The code for the color change:
<!-- html -->
<h2 class="color_button">We enhance brand loyalty</h2>
.
/* CSS */
.enquire_button {
min-height: 2em;
width: 7em;
background-color: white;
border: 4px solid #f35626;
border-radius: 5px;
color: #f35626;
cursor: pointer;
font-size: 2em;
line-height: 2em;
-webkit-transition: color .4s;
-o-transition: color .4s;
transition: color .4s;
-webkit-animation: hue 60s linear;
-o-animation: hue 60s linear;
animation: hue 60s linear;
text-align: center;
}
.color_button {
animation-name: color_change;
animation-duration: 10s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#-webkit-keyframes color_change {
0% { color: #da6e16; border: 4px solid #da6e16; }
25% { color: #82da16; border: 4px solid #82da16; }
50% { color: #16dad0; border: 4px solid #16dad0; }
75% { color: #d41a82; border: 4px solid #d41a82; }
100% { color: #d41a82; border: 4px solid #d41a82; }
}
#-moz-keyframes color_change {
0% { color: #da6e16; border: 4px solid #da6e16; }
25% { color: #82da16; border: 4px solid #82da16; }
50% { color: #16dad0; border: 4px solid #16dad0; }
75% { color: #d41a82; border: 4px solid #d41a82; }
100% { color: #d41a82; border: 4px solid #d41a82; }
}
#-ms-keyframes color_change {
0% { color: #da6e16; border: 4px solid #da6e16; }
25% { color: #82da16; border: 4px solid #82da16; }
50% { color: #16dad0; border: 4px solid #16dad0; }
75% { color: #d41a82; border: 4px solid #d41a82; }
100% { color: #d41a82; border: 4px solid #d41a82; }
}
#-o-keyframes color_change {
0% { color: #da6e16; border: 4px solid #da6e16; }
25% { color: #82da16; border: 4px solid #82da16; }
50% { color: #16dad0; border: 4px solid #16dad0; }
75% { color: #d41a82; border: 4px solid #d41a82; }
100% { color: #d41a82; border: 4px solid #d41a82; }
}
#keyframes color_change {
0% { color: #da6e16; border: 4px solid #da6e16; }
25% { color: #82da16; border: 4px solid #82da16; }
50% { color: #16dad0; border: 4px solid #16dad0; }
75% { color: #d41a82; border: 4px solid #d41a82; }
100% { color: #d41a82; border: 4px solid #d41a82; }
}
Add border to .color_button class
.color_button
{
border:solid;
In your keyframes, only declare the border-color and not the entire border style. Then, in any other element which uses that same keyframes and needs a border, make sure the original element has the border style with the proper width.
#keyframes color_change {
0% { color: #da6e16; border-color:#da6e16; }
25% { color: #82da16; border-color:#82da16; }
50% { color: #16dad0; border-color:#16dad0; }
75% { color: #d41a82; border-color:#d41a82; }
100% { color: #d41a82; border-color:#d41a82; }
}
(plus of course the same change in all the vendor prefixed styles.)
I use the CSS code from here for my website loader. I am having problem with IE and Mozilla everything doesn't look and work the way is supposed to.
In IE there's not animation and the graphics break, and in Mozilla is not animation and the graphics doesn't look right as well.
#bg: #2c3e50;
/*.triangle(#triangle: border-left: 60px solid transparent;
border-right: solid transparent;
border-top: 0 solid transparent;);*/
body{
background: #bg;
}
.loader {
border-radius: 50%;
margin: 0 auto;
position: absolute;
top: 40%;
left: 0;
right: 0;
height: 50px;
width: 50px;
}
.tri {
animation: translateRotation 1.5s infinite reverse;
-webkit-animation: translateRotation 1.5s infinite reverse;
border-left: 60px solid transparent;
border-right: 60px solid transparent;
border-top: 0 solid transparent;
border-bottom: 60px solid #00b4ff;
width: 0px;
z-index: 2;
}
.tri2 {
animation: translateRotation 1.5s infinite;
-webkit-animation: translateRotation 1.5s infinite;
border-left: 40px solid transparent;
border-right: 40px solid transparent;
border-top: 0px solid transparent;
border-bottom: 40px solid #ffde15;
width: 0px;
z-index: 1;
}
.tri3 {
animation: translateRotation 1.5s infinite;
-webkit-animation: translateRotation 1.5s infinite;
border-left: 40px solid transparent;
border-right: 40px solid transparent;
border-top: 40px solid #1da158;
border-bottom: 0px solid transparent;
width: 0px;
z-index: 1;
}
.tri4 {
animation: translateRotation 1.5s infinite reverse;
-webkit-animation: translateRotation 1.5s infinite reverse;
border-left: 60px solid transparent;
border-right: 60px solid transparent;
border-top: 60px solid #ea343f;
border-bottom: 0px solid transparent;
width: 0px;
z-index: 2;
}
.circ {
border: 30px solid rgba(255,255,255,0.1);
}
.circ2 {
border: 25px solid rgba(255,255,255,1);
box-sizing: border-box;
box-shadow: 0 2px 1px rgba(0,0,0, 0.15), 0 -2px 1px rgba(0,0,0, 0.15), -2px 0 1px rgba(0,0,0, 0.15), 2px 0 1px rgba(0,0,0, 0.15);
margin-top: 30px;
z-index: 90;
}
/* ANIMATE */
#-webkit-keyframes translateRotation {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg);}
}
The problem is that you are using only #-webkit-keyframes instead of #keyframes and -webkit-transform instead of transform which are supported without prefixes since IE10+
You should add this code above your animation keyframe and should work on IE10+:
#keyframes translateRotation {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg);}
}
Check here keyframe-animation-syntax to see all the prefixes.
For IE9 you probably should use Javascript animations like jQuery/jQueryUI, you can check if is necessary to use using Modernizr
if(!Modernizr.cssanimations) {
// Fallback
}
I have this icon (png)
and I was wondering how to create it only using HTML and CSS and animated, so those 3 quadrangles keep on changing their opacity (one after each other), so it looks kinda like a loader.
Any ideas?
Thanks!
Check this http://jsfiddle.net/jo3d9f27/
HTML
<div id="down"></div>
<div id="down1"></div>
<div id="down2"></div>
CSS
#down {
width: 0;
height: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
opacity:0;
border-top: 20px solid #f00;
}
#down1 {
width: 0;
height: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-top: 20px solid #f00;
}
#down2 {
width: 0;
height: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-top: 20px solid #f00;
}
#-webkit-keyframes anim{
from{opacity:0;}
to{opacity:1;}
}
#down{
-webkit-animation:anim 4s;
-webkit-animation-delay:1s;
-webkit-animation-iteration-count:infinite;
-webkit-animation-direction:alternate;
-webkit-animation-timing-function: ease-in-out;
}
#-webkit-keyframes anim2{
from{opacity:0;}
to{opacity:1;}
}
#down1{
-webkit-animation:anim2 4s;
-webkit-animation-delay:2s;
-webkit-animation-iteration-count:infinite;
-webkit-animation-direction:alternate;
-webkit-animation-timing-function: ease-in-out;
}
#-webkit-keyframes anim3{
from{opacity:0;}
to{opacity:1;}
}
#down2{
-webkit-animation:anim 4s;
-webkit-animation-delay:3s;
-webkit-animation-iteration-count:infinite;
-webkit-animation-direction:alternate;
-webkit-animation-timing-function: ease-in-out;
}
DEMO
http://jsfiddle.net/rijosh/u5r5vrk2/2/
HTML
<div id="mouse-scroll" class="ng-scope" style="display: block;">
<div class="mouse"><div class="wheel"></div></div>
<div><span class="unu"></span> <span class="doi"></span> <span class="trei"></span> </div>
</div>
CSS
#mouse-scroll {position:fixed;margin:auto;left:50%;bottom:80px;-webkit-transform:translateX(-50%);z-index:9999}
#mouse-scroll span {display:block;width:5px;height:5px;-ms-transform:rotate(45deg);-webkit-transform:rotate(45deg);transform:rotate(45deg);border-right:2px solid #dddddd;border-bottom:2px solid #dddddd;margin:0 0 3px 5px}
#mouse-scroll .unu {margin-top:6px}
#mouse-scroll .unu, #mouse-scroll .doi, #mouse-scroll .trei {-webkit-animation:mouse-scroll 1s infinite;-moz-animation:mouse-scroll 1s infinite}
#mouse-scroll .unu {-webkit-animation-delay:.1s;-moz-animation-delay:.1s;-webkit-animation-direction:alternate}
#mouse-scroll .doi {-webkit-animation-delay:.2s;-moz-animation-delay:.2s;-webkit-animation-direction:alternate}
#mouse-scroll .trei {-webkit-animation-delay:.3s;-moz-animation-delay:.3s;-webkit-animation-direction:alternate}
#mouse-scroll .mouse {height:21px;width:14px;border-radius:10px;-webkit-transform:none;-ms-transform:none;transform:none;border:2px solid #dddddd;top:170px}
#mouse-scroll .wheel {height:5px;width:2px;display:block;margin:5px auto;background:#dddddd;position:relative}
#mouse-scroll .wheel {-webkit-animation:mouse-wheel 1.2s ease infinite;-moz-animation:mouse-wheel 1.2s ease infinite}
#-webkit-keyframes mouse-wheel {
0% {opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}
100% {opacity:0;-webkit-transform:translateY(6px);-ms-transform:translateY(6px);transform:translateY(6px)}
}
#-webkit-keyframes mouse-wheel {
0% {opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}
100% {opacity:0;-webkit-transform:translateY(6px);-ms-transform:translateY(6px);transform:translateY(6px)}
}
How can someone achieve the effect shown here using pure css3.
Using this (pure CSS/without javascript):
Animated progress circle in CSS
Using the :target selector
I create an example, Probably still not what you are looking for, but it was the closest I came.
Example (Demo in jsfiddle):
<style>
#-webkit-keyframes rotate {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
#-moz-keyframes rotate {
from {
-moz-transform: rotate(0deg);
}
to {
-moz-transform: rotate(360deg);
}
}
#-o-keyframes rotate {
from {
-o-transform: rotate(0deg);
}
to {
-o-transform: rotate(360deg);
}
}
#keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
#startupload:target {
/*"disable" button*/
background: transparent;
border: none;
}
#startupload:target div.before {
/*Hide If has hash in url address browser*/
display: none;
}
#startupload div.progress-circle-container {
position: relative;
height: 230px;
width: 230px;
margin: 0 auto;
display: none; /*hide If no Hash in address*/
}
#startupload:target div.progress-circle-container {
display: block; /*Show If Hash in address*/
}
#startupload div.progress-circle-container div.progress-circle-outer {
background-color: #faef85;
background-repeat: repeat-x;
background-image: -moz-linear-gradient(0deg, #d66f0f, #faef85);
background-image: -webkit-linear-gradient(0deg, #d66f0f, #faef85);
background-image: -o-linear-gradient(0deg, #d66f0f, #faef85);
background-image: linear-gradient(0deg, #d66f0f, #faef85);
width: 230px;
height: 230px;
position: absolute;
-webkit-animation-play-state: paused;
-moz-animation-play-state: paused;
-o-animation-play-state: paused;
animation-play-state: paused;
-webkit-animation: rotate 2.2s infinite linear;
-moz-animation: rotate 2.2s infinite linear;
-o-animation: rotate 2.2s infinite linear;
animation: rotate 2.2s infinite linear;
-webkit-box-shadow: inset 0 2px 10px #d58513,inset 0 0 20px #b93d00,0 0 15px rgba(216, 140, 23, 0.25);
-moz-box-shadow: inset 0 2px 10px #d58513,inset 0 0 20px #b93d00,0 0 15px rgba(216, 140, 23, 0.25);
box-shadow: inset 0 2px 10px #d58513,inset 0 0 20px #b93d00,0 0 15px rgba(216, 140, 23, 0.25);
-webkit-border-radius: 200px;
-moz-border-radius: 200px;
border-radius: 200px;
}
#startupload:target div.progress-circle-container div.progress-circle-outer.animate {
-webkit-animation-play-state: running;
-moz-animation-play-state: running;
-o-animation-play-state: running;
animation-play-state: running;
}
#startupload div.progress-circle-container div.progress-circle-inner {
height: 170px;
width: 170px;
margin: 0 auto;
position: absolute;
left: 30px;
top: 30px;
-webkit-border-radius: 200px;
-moz-border-radius: 200px;
border-radius: 200px;
background-color: #fff;/*change color background*/
-webkit-box-shadow: inset 0 2px 1px #ffffff,inset 0 -1px 1px rgba(0, 0, 0, 0.08),inset 0 -3px 1px rgba(0, 0, 0, 0.09),0 2px 2px rgba(0, 0, 0, 0.3);
-moz-box-shadow: inset 0 2px 1px #ffffff,inset 0 -1px 1px rgba(0, 0, 0, 0.08),inset 0 -3px 1px rgba(0, 0, 0, 0.09),0 2px 2px rgba(0, 0, 0, 0.3);
box-shadow: inset 0 2px 1px #ffffff,inset 0 -1px 1px rgba(0, 0, 0, 0.08),inset 0 -3px 1px rgba(0, 0, 0, 0.09),0 2px 2px rgba(0, 0, 0, 0.3);
text-align: center;
}
</style>
<form action="#startupload">
<button id="startupload" type="submit">
<div class="before">
Start upload
</div>
<div class="progress-circle-container">
<div class="progress-circle-outer animate">
</div>
<div class="progress-circle-inner"></div>
</div>
</button>
</form>
Perhaps the ultimate goal to achieve the best is something like:
css3 animations frame by frame