Unwanted box appearing around text in chrome but not other browsers - html

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.)

Related

How to animate first letter with CSS3

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>

Rainbow text animation using only CSS

I got inspired by this Rainbow Text Animation rainbow-text-animation, and I would like to use only CSS to make this happen instead of all that complicated SCSS coding.
I got what I like so far and now I just want to make it go from left to right AND having multiple colors in one entire line instead of one color at a time.
Run the code snippet to see what I'm talking about.
So as you can see, I want as many colors I want in one line and not one color in the entire line (one at a time).
#shadowBox {
background-color: rgb(0, 0, 0);
/* Fallback color */
background-color: rgba(0, 0, 0, 0.2);
/* Black w/opacity/see-through */
border: 3px solid;
}
.rainbow {
text-align: center;
text-decoration: underline;
font-size: 32px;
font-family: monospace;
letter-spacing: 5px;
animation: colorRotate 6s linear 0s infinite;
}
#keyframes colorRotate {
from {
color: #6666ff;
}
10% {
color: #0099ff;
}
50% {
color: #00ff00;
}
75% {
color: #ff3399;
}
100% {
color: #6666ff;
}
}
<div id="shadowBox">
<h3 class="rainbow">COMING SOON</h3>
</div>
You can achieve this effect by using a moving gradient background, color to transparent, and background clip to text.
#shadowBox {
background-color: rgb(0, 0, 0);
/* Fallback color */
background-color: rgba(0, 0, 0, 0.2);
/* Black w/opacity/see-through */
border: 3px solid;
}
.rainbow {
text-align: center;
text-decoration: underline;
font-size: 32px;
font-family: monospace;
letter-spacing: 5px;
}
.rainbow_text_animated {
background: linear-gradient(to right, #6666ff, #0099ff , #00ff00, #ff3399, #6666ff);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
animation: rainbow_animation 6s ease-in-out infinite;
background-size: 400% 100%;
}
#keyframes rainbow_animation {
0%,100% {
background-position: 0 0;
}
50% {
background-position: 100% 0;
}
}
<div id="shadowBox">
<h3 class="rainbow rainbow_text_animated">COMING SOON</h3>
</div>
#shadowBox {
background-color: rgb(0, 0, 0);
/* Fallback color */
background-color: rgba(0, 0, 0, 0.2);
/* Black w/opacity/see-through */
border: 3px solid;
}
.rainbow {
text-align: center;
text-decoration: underline;
font-size: 32px;
font-family: monospace;
letter-spacing: 5px;
animation: colorRotate .5s linear 0s infinite;
}
#keyframes colorRotate {
from {
color: #6666ff;
}
10% {
color: #0099ff;
}
50% {
color: #00ff00;
}
75% {
color: #ff3399;
}
100% {
color: #6666ff;
}
}
<div id="shadowBox">
<h3 class="rainbow">VERB</h3>
</div>

How to have a color change animation on a button outline?

trying to recreate the button outline effect on the https://daneden.github.io/animate.css/ . I tried looking over the code and could not figure out what was triggering what, so I created a color changing effect from some tutorials and then ripped the css of the button styling from the animate.css page and merged them together. The color animation has been applied to the button, but what I cannot seem to work out is how you then apply that color animation to only the outline and the inside text. I also am wondering how I made can make the color changing more gradual as even after increasing the animation duration it still feels too sudden.
My attempt:
http://codepen.io/Dingerzat/pen/pNNgZj
/* CSS */
.modal__button {
-webkit-animation: hue 60s linear;
-o-animation: hue 60s linear;
animation: hue 60s linear;
background-color: transparent;
border: 2px solid #f35626;
color: #f35626;
cursor: pointer;
font-size: 15px;
outline: none;
padding: 7px 22px;
-webkit-transition: background-color .4s, color .4s;
-o-transition: background-color .4s, color .4s;
transition: background-color .4s, color .4s;
}
.color {
animation-name: color_change;
animation-duration: 10s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#-webkit-keyframes color_change {
0% { background-color: #da6e16; }
25% { background-color: #82da16; }
50% { background-color: #16dad0; }
75% { background-color: #d41a82; }
100% { background-color: #d41a82 }
}
#-moz-keyframes color_change {
0% { background-color: #da6e16; }
25% { background-color: #82da16; }
50% { background-color: #16dad0; }
75% { background-color: #d41a82; }
100% { background-color: #d41a82 }
}
#-ms-keyframes color_change {
0% { background-color: #da6e16; }
25% { background-color: #82da16; }
50% { background-color: #16dad0; }
75% { background-color: #d41a82; }
100% { background-color: #d41a82 }
}
#-o-keyframes color_change {
0% { background-color: #da6e16; }
25% { background-color: #82da16; }
50% { background-color: #16dad0; }
75% { background-color: #d41a82; }
100% { background-color: #d41a82 }
}
#keyframes color_change {
0% { background-color: #da6e16; }
25% { background-color: #82da16; }
50% { background-color: #16dad0; }
75% { background-color: #d41a82; }
100% { background-color: #d41a82 }
}
<!-- HTML -->
<button class="modal_button color">ddd</button>
Here's a version that changes text-color and border-color, instead of background.
/* CSS */
.modal_button {
min-height: 2em;
width: 5em;
background-color: white;
border: 2px solid #f35626;
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 {
animation-name: color_change;
animation-duration: 10s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#-webkit-keyframes color_change {
0% { color: #da6e16; border: 2px solid #da6e16; }
25% { color: #82da16; border: 2px solid #82da16; }
50% { color: #16dad0; border: 2px solid #16dad0; }
75% { color: #d41a82; border: 2px solid #d41a82; }
100% { color: #d41a82; border: 2px solid #d41a82; }
}
#-moz-keyframes color_change {
0% { color: #da6e16; border: 2px solid #da6e16; }
25% { color: #82da16; border: 2px solid #82da16; }
50% { color: #16dad0; border: 2px solid #16dad0; }
75% { color: #d41a82; border: 2px solid #d41a82; }
100% { color: #d41a82; border: 2px solid #d41a82; }
}
#-ms-keyframes color_change {
0% { color: #da6e16; border: 2px solid #da6e16; }
25% { color: #82da16; border: 2px solid #82da16; }
50% { color: #16dad0; border: 2px solid #16dad0; }
75% { color: #d41a82; border: 2px solid #d41a82; }
100% { color: #d41a82; border: 2px solid #d41a82; }
}
#-o-keyframes color_change {
0% { color: #da6e16; border: 2px solid #da6e16; }
25% { color: #82da16; border: 2px solid #82da16; }
50% { color: #16dad0; border: 2px solid #16dad0; }
75% { color: #d41a82; border: 2px solid #d41a82; }
100% { color: #d41a82; border: 2px solid #d41a82; }
}
#keyframes color_change {
0% { color: #da6e16; border: 2px solid #da6e16; }
25% { color: #82da16; border: 2px solid #82da16; }
50% { color: #16dad0; border: 2px solid #16dad0; }
75% { color: #d41a82; border: 2px solid #d41a82; }
100% { color: #d41a82; border: 2px solid #d41a82; }
}
<button class="modal_button color">Button</button>
There is type error in class name: modal_button
In Css : modal__button
Just change it and it work fine.
/* CSS */
.modal__button {
-webkit-animation: hue 60s linear;
-o-animation: hue 60s linear;
animation: hue 60s linear;
background-color: transparent;
border: 2px solid #f35626;
color: #f35626;
cursor: pointer;
font-size: 15px;
outline: none;
padding: 7px 22px;
-webkit-transition: background-color .4s, color .4s;
-o-transition: background-color .4s, color .4s;
transition: background-color .4s, color .4s;
}
.color {
animation-name: color_change;
animation-duration: 10s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#-webkit-keyframes color_change {
0% { background-color: #da6e16; }
25% { background-color: #82da16; }
50% { background-color: #16dad0; }
75% { background-color: #d41a82; }
100% { background-color: #d41a82 }
}
#-moz-keyframes color_change {
0% { background-color: #da6e16; }
25% { background-color: #82da16; }
50% { background-color: #16dad0; }
75% { background-color: #d41a82; }
100% { background-color: #d41a82 }
}
#-ms-keyframes color_change {
0% { background-color: #da6e16; }
25% { background-color: #82da16; }
50% { background-color: #16dad0; }
75% { background-color: #d41a82; }
100% { background-color: #d41a82 }
}
#-o-keyframes color_change {
0% { background-color: #da6e16; }
25% { background-color: #82da16; }
50% { background-color: #16dad0; }
75% { background-color: #d41a82; }
100% { background-color: #d41a82 }
}
#keyframes color_change {
0% { background-color: #da6e16; }
25% { background-color: #82da16; }
50% { background-color: #16dad0; }
75% { background-color: #d41a82; }
100% { background-color: #d41a82 }
}
<!-- HTML -->
<button class="modal__button color">ddd</button>
For Change text color and Button border:
.modal__button {
-webkit-animation: hue 60s linear;
-o-animation: hue 60s linear;
animation: hue 60s linear;
background-color: transparent;
border: 2px solid #f35626;
color: #f35626;
cursor: pointer;
font-size: 15px;
outline: none;
padding: 7px 22px;
-webkit-transition: background-color .4s, color .4s;
-o-transition: background-color .4s, color .4s;
transition: background-color .4s, color .4s;
}
.color {
animation-name: color_change;
animation-duration: 10s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#-webkit-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;}
}
#-moz-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;}
}
#-ms-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;}
}
#-o-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;}
}
#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;}
}
<button class="modal__button color">Button Text</button>

How can I add a link to the <i> tag?

I try to style some tags to get some good-looking social media buttons.
This is my current code:
#import url("//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css");
/* General rule */
.dist {
margin-left: 7px;
}
.button-big {
font-size: 2em;
width: 50px;
text-align: center;
padding: 0.2em 0em 0.2em 0em;
display: inline-block;
}
/* Facebook class and animation */
.facebook {
color: #3B5998;
border: 1px solid #3B5998;
}
.facebook:hover {
animation: facebookAnim 0.4s normal forwards linear;
-webkit-animation: facebookAnim 0.4s normal forwards linear;
}
#keyframes facebookAnim {
50% {
background-color: #3B5998;
}
100% {
background-color: #3B5998;
border: 1px solid #3B5998;
color: #fff;
}
}
#-webkit-keyframes facebookAnim {
50% {
background-color: #3B5998;
}
100% {
background-color: #3B5998;
border: 1px solid #3B5998;
color: #fff;
}
}
/* YouTube class and animation */
.youtube {
color: #bb0000;
border: 1px solid #bb0000;
}
.youtube:hover {
animation: youtubeAnim 0.4s normal forwards linear;
-webkit-animation: youtubeAnim 0.4s normal forwards linear;
}
#keyframes youtubeAnim {
50% {
background-color: #bb0000;
}
100% {
background-color: #bb0000;
border: 1px solid #bb0000;
color: #fff;
}
}
#-webkit-keyframes youtubeAnim {
50% {
background-color: #bb0000;
}
100% {
background-color: #bb0000;
border: 1px solid #bb0000;
color: #fff;
}
}
/* Instagram class and animation */
.instagram {
color: #125688;
border: 1px solid #125688;
}
.instagram:hover {
animation: instaAnim 0.4s normal forwards linear;
-webkit-animation: instaAnim 0.4s normal forwards linear;
}
#-webkit-keyframes instaAnim {
50% {
background-color: #125688;
}
100% {
background-color: #125688;
border: 1px solid #125688;
color: #fff;
}
}
#keyframes instaAnim {
50% {
background-color: #125688;
}
100% {
background-color: #125688;
border: 1px solid #125688;
color: #fff;
}
}
/* link style */
.facebook a {
color: #3B5998;
}
.youtube a {
color: #bb0000;
}
.instagram a {
color: #125688;
}
.facebook a:hover {
color: #fff;
}
.youtube a:hover {
color: #fff;
}
.instagram a:hover {
color: #fff;
}
<div class="facebook button-big">
<i class="fa fa-facebook"></i>
</div>
<div class="youtube button-big dist">
<i class="fa fa-youtube"></i>
</div>
<div class="instagram button-big dist">
<i class="fa fa-instagram"></i>
</div>
The problem is that the links is just on the icon, so when I hover the button a bit outside, the icon is style in the old color and not white. I hope you get what I mean, just have a look please.
How can I fix this the best way?
Encapsulate the divs in the a tags.
Add some styling to the a tag.
#import url("//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css");
/* General rule */
a {
text-decoration: none;
}
.dist {
margin-left: 7px;
}
.button-big {
font-size: 2em;
width: 50px;
text-align: center;
padding: 0.2em 0em 0.2em 0em;
display: inline-block;
}
/* Facebook class and animation */
.facebook {
color: #3B5998;
border: 1px solid #3B5998;
}
.facebook:hover {
animation: facebookAnim 0.4s normal forwards linear;
-webkit-animation: facebookAnim 0.4s normal forwards linear;
}
#keyframes facebookAnim {
50% {
background-color: #3B5998;
}
100% {
background-color: #3B5998;
border: 1px solid #3B5998;
color: #fff;
}
}
#-webkit-keyframes facebookAnim {
50% {
background-color: #3B5998;
}
100% {
background-color: #3B5998;
border: 1px solid #3B5998;
color: #fff;
}
}
/* YouTube class and animation */
.youtube {
color: #bb0000;
border: 1px solid #bb0000;
}
.youtube:hover {
animation: youtubeAnim 0.4s normal forwards linear;
-webkit-animation: youtubeAnim 0.4s normal forwards linear;
}
#keyframes youtubeAnim {
50% {
background-color: #bb0000;
}
100% {
background-color: #bb0000;
border: 1px solid #bb0000;
color: #fff;
}
}
#-webkit-keyframes youtubeAnim {
50% {
background-color: #bb0000;
}
100% {
background-color: #bb0000;
border: 1px solid #bb0000;
color: #fff;
}
}
/* Instagram class and animation */
.instagram {
color: #125688;
border: 1px solid #125688;
}
.instagram:hover {
animation: instaAnim 0.4s normal forwards linear;
-webkit-animation: instaAnim 0.4s normal forwards linear;
}
#-webkit-keyframes instaAnim {
50% {
background-color: #125688;
}
100% {
background-color: #125688;
border: 1px solid #125688;
color: #fff;
}
}
#keyframes instaAnim {
50% {
background-color: #125688;
}
100% {
background-color: #125688;
border: 1px solid #125688;
color: #fff;
}
}
/* link style */
.facebook a {
color: #3B5998;
}
.youtube a {
color: #bb0000;
}
.instagram a {
color: #125688;
}
.facebook a:hover {
color: #fff;
}
.youtube a:hover {
color: #fff;
}
.instagram a:hover {
color: #fff;
}
<a href="#">
<div class="facebook button-big">
<i class="fa fa-facebook"></i>
</div>
</a>
<a href="#">
<div class="youtube button-big dist">
<i class="fa fa-youtube"></i>
</div>
</a>
<a href="#">
<div class="instagram button-big dist">
<i class="fa fa-instagram"></i>
</div>
</a>
Another solution is to change the links color when you hover the button, like this:
.facebook:hover a {
color: #fff;
}
.youtube:hover a {
color: #fff;
}
.instagram:hover a {
color: #fff;
}
Full snippet:
#import url("//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css");
/* General rule */
.dist {
margin-left: 7px;
}
.button-big {
font-size: 2em;
width: 50px;
text-align: center;
padding: 0.2em 0em 0.2em 0em;
display: inline-block;
}
/* Facebook class and animation */
.facebook {
color: #3B5998;
border: 1px solid #3B5998;
}
.facebook:hover {
animation: facebookAnim 0.4s normal forwards linear;
-webkit-animation: facebookAnim 0.4s normal forwards linear;
}
#keyframes facebookAnim {
50% {
background-color: #3B5998;
}
100% {
background-color: #3B5998;
border: 1px solid #3B5998;
color: #fff;
}
}
#-webkit-keyframes facebookAnim {
50% {
background-color: #3B5998;
}
100% {
background-color: #3B5998;
border: 1px solid #3B5998;
color: #fff;
}
}
/* YouTube class and animation */
.youtube {
color: #bb0000;
border: 1px solid #bb0000;
}
.youtube:hover {
animation: youtubeAnim 0.4s normal forwards linear;
-webkit-animation: youtubeAnim 0.4s normal forwards linear;
}
#keyframes youtubeAnim {
50% {
background-color: #bb0000;
}
100% {
background-color: #bb0000;
border: 1px solid #bb0000;
color: #fff;
}
}
#-webkit-keyframes youtubeAnim {
50% {
background-color: #bb0000;
}
100% {
background-color: #bb0000;
border: 1px solid #bb0000;
color: #fff;
}
}
/* Instagram class and animation */
.instagram {
color: #125688;
border: 1px solid #125688;
}
.instagram:hover {
animation: instaAnim 0.4s normal forwards linear;
-webkit-animation: instaAnim 0.4s normal forwards linear;
}
#-webkit-keyframes instaAnim {
50% {
background-color: #125688;
}
100% {
background-color: #125688;
border: 1px solid #125688;
color: #fff;
}
}
#keyframes instaAnim {
50% {
background-color: #125688;
}
100% {
background-color: #125688;
border: 1px solid #125688;
color: #fff;
}
}
/* link style */
.facebook a {
color: #3B5998;
}
.youtube a {
color: #bb0000;
}
.instagram a {
color: #125688;
}
.facebook:hover a {
color: #fff;
}
.youtube:hover a {
color: #fff;
}
.instagram:hover a {
color: #fff;
}
<div class="facebook button-big">
<i class="fa fa-facebook"></i>
</div>
<div class="youtube button-big dist">
<i class="fa fa-youtube"></i>
</div>
<div class="instagram button-big dist">
<i class="fa fa-instagram"></i>
</div>
It is possible.
Try this code in your css:
.button-big:hover a i {
color: #fff;
}
As a quick fix, you could just inherit animation:
.button-big a , a i {
animation:inherit;
}
#import url("//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css");
/* General rule */
.dist {
margin-left: 7px;
}
.button-big {
font-size: 2em;
width: 50px;
text-align: center;
padding: 0.2em 0em 0.2em 0em;
display: inline-block;
}
/* Facebook class and animation */
.facebook {
color: #3B5998;
border: 1px solid #3B5998;
}
.facebook:hover {
animation: facebookAnim 0.4s normal forwards linear;
-webkit-animation: facebookAnim 0.4s normal forwards linear;
}
#keyframes facebookAnim {
50% {
background-color: #3B5998;
}
100% {
background-color: #3B5998;
border: 1px solid #3B5998;
color: #fff;
}
}
#-webkit-keyframes facebookAnim {
50% {
background-color: #3B5998;
}
100% {
background-color: #3B5998;
border: 1px solid #3B5998;
color: #fff;
}
}
/* YouTube class and animation */
.youtube {
color: #bb0000;
border: 1px solid #bb0000;
}
.youtube:hover {
animation: youtubeAnim 0.4s normal forwards linear;
-webkit-animation: youtubeAnim 0.4s normal forwards linear;
}
#keyframes youtubeAnim {
50% {
background-color: #bb0000;
}
100% {
background-color: #bb0000;
border: 1px solid #bb0000;
color: #fff;
}
}
#-webkit-keyframes youtubeAnim {
50% {
background-color: #bb0000;
}
100% {
background-color: #bb0000;
border: 1px solid #bb0000;
color: #fff;
}
}
/* Instagram class and animation */
.instagram {
color: #125688;
border: 1px solid #125688;
}
.instagram:hover {
animation: instaAnim 0.4s normal forwards linear;
-webkit-animation: instaAnim 0.4s normal forwards linear;
}
#-webkit-keyframes instaAnim {
50% {
background-color: #125688;
}
100% {
background-color: #125688;
border: 1px solid #125688;
color: #fff;
}
}
#keyframes instaAnim {
50% {
background-color: #125688;
}
100% {
background-color: #125688;
border: 1px solid #125688;
color: #fff;
}
}
/* link style */
.facebook a {
color: #3B5998;
}
.youtube a {
color: #bb0000;
}
.instagram a {
color: #125688;
}
.facebook a:hover {
color: #fff;
}
.youtube a:hover {
color: #fff;
}
.instagram a:hover {
color: #fff;
}
.button-big a , a i {
animation:inherit;
}
<div class="facebook button-big">
<i class="fa fa-facebook"></i>
</div>
<div class="youtube button-big dist">
<i class="fa fa-youtube"></i>
</div>
<div class="instagram button-big dist">
<i class="fa fa-instagram"></i>
</div>
Or color
.button-big a , a i {
color:inherit;
}
#import url("//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css");
/* General rule */
.dist {
margin-left: 7px;
}
.button-big {
font-size: 2em;
width: 50px;
text-align: center;
padding: 0.2em 0em 0.2em 0em;
display: inline-block;
}
/* Facebook class and animation */
.facebook {
color: #3B5998;
border: 1px solid #3B5998;
}
.facebook:hover {
animation: facebookAnim 0.4s normal forwards linear;
-webkit-animation: facebookAnim 0.4s normal forwards linear;
}
#keyframes facebookAnim {
50% {
background-color: #3B5998;
}
100% {
background-color: #3B5998;
border: 1px solid #3B5998;
color: #fff;
}
}
#-webkit-keyframes facebookAnim {
50% {
background-color: #3B5998;
}
100% {
background-color: #3B5998;
border: 1px solid #3B5998;
color: #fff;
}
}
/* YouTube class and animation */
.youtube {
color: #bb0000;
border: 1px solid #bb0000;
}
.youtube:hover {
animation: youtubeAnim 0.4s normal forwards linear;
-webkit-animation: youtubeAnim 0.4s normal forwards linear;
}
#keyframes youtubeAnim {
50% {
background-color: #bb0000;
}
100% {
background-color: #bb0000;
border: 1px solid #bb0000;
color: #fff;
}
}
#-webkit-keyframes youtubeAnim {
50% {
background-color: #bb0000;
}
100% {
background-color: #bb0000;
border: 1px solid #bb0000;
color: #fff;
}
}
/* Instagram class and animation */
.instagram {
color: #125688;
border: 1px solid #125688;
}
.instagram:hover {
animation: instaAnim 0.4s normal forwards linear;
-webkit-animation: instaAnim 0.4s normal forwards linear;
}
#-webkit-keyframes instaAnim {
50% {
background-color: #125688;
}
100% {
background-color: #125688;
border: 1px solid #125688;
color: #fff;
}
}
#keyframes instaAnim {
50% {
background-color: #125688;
}
100% {
background-color: #125688;
border: 1px solid #125688;
color: #fff;
}
}
/* link style */
.facebook a {
color: #3B5998;
}
.youtube a {
color: #bb0000;
}
.instagram a {
color: #125688;
}
.facebook a:hover {
color: #fff;
}
.youtube a:hover {
color: #fff;
}
.instagram a:hover {
color: #fff;
}
.button-big a , a i {
color:inherit;
}
<div class="facebook button-big">
<i class="fa fa-facebook"></i>
</div>
<div class="youtube button-big dist">
<i class="fa fa-youtube"></i>
</div>
<div class="instagram button-big dist">
<i class="fa fa-instagram"></i>
</div>

CSS error in other browsers

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
}