CSS3 animate border color - css

I want to animate borders of an element using CSS3, whether it's in hover state or normal state. Can someone provide me a code snippet for this or can guide?
I can do this using jQuery but looking for some pure CSS3 solution.

You can use a CSS3 transition for this. Have a look at this example:
http://jsfiddle.net/ujDkf/1/
Here is the main code:
#box {
position : relative;
width : 100px;
height : 100px;
background-color : gray;
border : 5px solid black;
-webkit-transition : border 500ms ease-out;
-moz-transition : border 500ms ease-out;
-o-transition : border 500ms ease-out;
transition : border 500ms ease-out;
}
#box:hover {
border : 10px solid red;
}

You can try this also...
button {
background: none;
border: 0;
box-sizing: border-box;
margin: 1em;
padding: 1em 2em;
box-shadow: inset 0 0 0 2px #f45e61;
color: #f45e61;
font-size: inherit;
font-weight: 700;
vertical-align: middle;
position: relative;
}
button::before, button::after {
box-sizing: inherit;
content: '';
position: absolute;
width: 100%;
height: 100%;
}
.draw {
-webkit-transition: color 0.25s;
transition: color 0.25s;
}
.draw::before, .draw::after {
border: 2px solid transparent;
width: 0;
height: 0;
}
.draw::before {
top: 0;
left: 0;
}
.draw::after {
bottom: 0;
right: 0;
}
.draw:hover {
color: #60daaa;
}
.draw:hover::before, .draw:hover::after {
width: 100%;
height: 100%;
}
.draw:hover::before {
border-top-color: #60daaa;
border-right-color: #60daaa;
-webkit-transition: width 0.25s ease-out, height 0.25s ease-out 0.25s;
transition: width 0.25s ease-out, height 0.25s ease-out 0.25s;
}
.draw:hover::after {
border-bottom-color: #60daaa;
border-left-color: #60daaa;
-webkit-transition: border-color 0s ease-out 0.5s, width 0.25s ease-out 0.5s, height 0.25s ease-out 0.75s;
transition: border-color 0s ease-out 0.5s, width 0.25s ease-out 0.5s, height 0.25s ease-out 0.75s;
}
<section class="buttons">
<button class="draw">Draw</button>
</section>

If you need the transition to run infinitely, try the below example:
#box {
position: relative;
width: 100px;
height: 100px;
background-color: gray;
border: 5px solid black;
display: block;
}
#box:hover {
border-color: red;
animation-name: flash_border;
animation-duration: 2s;
animation-timing-function: linear;
animation-iteration-count: infinite;
-webkit-animation-name: flash_border;
-webkit-animation-duration: 2s;
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
-moz-animation-name: flash_border;
-moz-animation-duration: 2s;
-moz-animation-timing-function: linear;
-moz-animation-iteration-count: infinite;
}
#keyframes flash_border {
0% {
border-color: red;
}
50% {
border-color: black;
}
100% {
border-color: red;
}
}
#-webkit-keyframes flash_border {
0% {
border-color: red;
}
50% {
border-color: black;
}
100% {
border-color: red;
}
}
#-moz-keyframes flash_border {
0% {
border-color: red;
}
50% {
border-color: black;
}
100% {
border-color: red;
}
}
<div id="box">roll over me</div>

A bit late to this one but...
This is what I do:
.class {
color: tomato;
border: 10px solid currentColor;
transition: color 250ms linear;
// not part of solution just layout
width: 100px;
height: 100px;
display: flex;
justify-content: center;
align-items: center;
font-size: 2rem;
text-transform: uppercase;
}
.class:hover {
color: rebeccapurple;
}
<div class='class' >color way</div>

Related

CSS Colored checkbox label text not inline stretch on the right of the checkbox

I have some css for a custom checkbox.
.test label {
position: absolute;
width: 13px;
height: 13px;
background-color: #ff0000;
color: #ffffff;
-webkit-transition: background-color 1s ease-out 1s;
-moz-transition: background-color 1s ease-out 1s;
-o-transition: background-color 1s ease-out 1s;
transition: background-color 1s ease-out 1s;
}
.test input[type=checkbox]:checked + label {
background-color:#ff0000;
-webkit-transition: background-color 1s ease-out 1s;
-moz-transition: background-color 1s ease-out 1s;
-o-transition: background-color 1s ease-out 1s;
transition: background-color 1s ease-out 1s;
}
.test label:after {
position: absolute;
bottom: 5px;
width: 12px;
height: 5px;
opacity: 0;
content: '';
background: transparent;
border: 2px solid #ffffff;
border-top: none;
border-right: none;
-webkit-transform: rotate(-50deg);
-moz-transform: rotate(-50deg);
-ms-transform: rotate(-50deg);
-o-transform: rotate(-50deg);
transform: rotate(-50deg);
filter: alpha(opacity=0);
}
.test input[type=checkbox] {
visibility: hidden;
}
.test input[type=checkbox]:checked + label:after {
opacity: 1;
filter: alpha(opacity=100);
}
<div class="test">
<input type="checkbox" value="none" id="test1" name="check">
<label for="test1">This text should be inline from left to right or the right of the checkbox</label>
</div>
The issue is that the text is all wrapping down in a width of 13 pixels and I need it on the right of the checkbox to stretch.
How can I fix this code?
Your code is completely incomprehensible, what is it that you're trying to achieve?
input[type="checkbox"]:checked+label {
background-color: #0a0;
}
label {
display: block;
position: relative;
padding-left: 30px;
margin-bottom: 12px;
line-height: 26px;
cursor: pointer;
font-size: 20px;
}
/* Hiding the checkbox */
input[type=checkbox] {
visibility: hidden;
}
/* Show a custom checkbox instead */
.custom {
position: absolute;
top: 0;
left: 0;
height: 25px;
width: 25px;
background-color: black;
-webkit-transition: background-color .2s ease-out .2s;
-moz-transition: background-color .2s ease-out .2s;
-o-transition: background-color .2s ease-out .2s;
transition: background-color .2s ease-out .2s;
}
label:hover input~.custom {
background-color: gray;
}
label input:active~.custom {
background-color: white;
}
label input:checked~.custom {
background-color: orange;
}
/* Checkmark to be shown in checkbox */
.custom:after {
content: "";
position: absolute;
display: none;
}
/* Display checkmark when checked */
label input:checked~.custom:after {
display: block;
}
label .custom:after {
left: 8px;
bottom: 5px;
width: 6px;
height: 12px;
border: solid white;
border-width: 0 4px 4px 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
<label for="check1">
Check this box
<input id="check1" type="checkbox">
<span class="custom"></span>
</label>
<label for="check2">
Or this one
<input id="check2" type="checkbox">
<span class="custom"></span>
</label>
<label for="check3">
Or all three
<input id="check3" type="checkbox">
<span class="custom"></span>
</label>

image height inside div container

I have a problem with my image which is inside a div.
This div with swiper__content class gives kind of bottom padding to the image and I can't see what cause this effect. I have a 100% height with no padding or margin so it might fit in the div
.no-padding{
padding: 0px 0px !important;
}
.swiper {
margin: 0 auto 50px;
width: 40%;
text-align: center;
padding: 10px 20px;
font-size: 10vw;
line-height: 1;
position: relative;
overflow: hidden;
text-transform: uppercase;
font-family: "Impact";
cursor: pointer;
}
.swiper__content {
color: transparent;
display: block;
}
.swiper .swiper__content img{
opacity: 0;
width: 100%;
height: 100%;
transition: opacity 0s ease-in 0.5s;
-moz-transition: opacity 0s ease-in 0.5s;
-webkit-transition: opacity 0s ease-in 0.5s;
-o-transition: opacity 0s ease-in 0.5s;
}
.swiper__bar, .swiper__bar--right {
width: 100%;
height: 100%;
background: orange;
display: block;
position: absolute;
top: 0;
left: 0;
transform: translateX(-100%);
transition: 1s ease-in-out;
}
.swiper__bar--right {
transform: translateX(100%);
}
.swiper.revealed .swiper__content {
animation-name: kf-font-reveal;
animation-duration: 1s;
color: orange;
}
.swiper.revealed .swiper__content img{
opacity: 1;
}
<div class="swiper no-padding revealed">
<div class="swiper__content">
<img src="http://lorempicsum.com/futurama/350/200/1">
</div>
<span class="swiper__bar--right"></span>
</div>
Is there a way to remove that ?
Set line-height: 0 for your swiper class.
.no-padding{
padding: 0px 0px !important;
}
.swiper {
margin: 0 auto 50px;
width: 40%;
text-align: center;
padding: 10px 20px;
font-size: 10vw;
line-height: 0;
position: relative;
overflow: hidden;
text-transform: uppercase;
font-family: "Impact";
cursor: pointer;
}
.swiper__content {
color: transparent;
display: block;
}
.swiper .swiper__content img{
opacity: 0;
width: 100%;
height: 100%;
transition: opacity 0s ease-in 0.5s;
-moz-transition: opacity 0s ease-in 0.5s;
-webkit-transition: opacity 0s ease-in 0.5s;
-o-transition: opacity 0s ease-in 0.5s;
}
.swiper__bar, .swiper__bar--right {
width: 100%;
height: 100%;
background: orange;
display: block;
position: absolute;
top: 0;
left: 0;
transform: translateX(-100%);
transition: 1s ease-in-out;
}
.swiper__bar--right {
transform: translateX(100%);
}
.swiper.revealed .swiper__content {
animation-name: kf-font-reveal;
animation-duration: 1s;
color: orange;
}
.swiper.revealed .swiper__content img{
opacity: 1;
}
<div class="swiper no-padding revealed">
<div class="swiper__content">
<img src="http://lorempicsum.com/futurama/350/200/1">
</div>
<span class="swiper__bar--right"></span>
</div>

Button CSS Hyperlink Using DIV

I am trying to use below buttons for my web pages. How to use it for setting hyper link in these buttons ?
#import url('http://fonts.googleapis.com/css?family=Roboto+Condensed');
.preserve-3d {
transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
}
body {
padding: 0;
margin: 0;
border: 0;
overflow-x: none;
background-color: #ffffff;
font-family: Roboto Condensed, sans-serif;
font-size: 12px;
font-smooth: always;
-webkit-font-smoothing: antialiased;
}
.back {
width: 33%;
height: 200px;
float: left;
background-color: #eeeeee;
border: 10px;
border-color: #ffffff;
border-style: solid;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
counter-increment: bc;
padding: 0px 5px 5px 5px;
}
.back:before {
content: counter(bc) "_";
position: absolute;
padding: 10px;
}
#media screen and (max-width: 1260px) {
.back {
width: 50%;
}
}
#media screen and (max-width: 840px) {
.back {
width: 100%;
}
}
.button_base {
margin: 0;
border: 0;
font-size: 18px;
position: relative;
top: 50%;
left: 50%;
margin-top: -25px;
margin-left: -100px;
width: 200px;
height: 50px;
text-align: center;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-user-select: none;
cursor: default;
}
.button_base:hover {
cursor: pointer;
}
/* ### ### ### 01 */
.b01_simple_rollover {
color: #000000;
border: #000000 solid 1px;
padding: 10px;
background-color: #ffffff;
}
.b01_simple_rollover:hover {
color: #ffffff;
background-color: #000000;
}
/* ### ### ### 02 */
.b02_slide_in {
overflow: hidden;
border: #000000 solid 1px;
}
.b02_slide_in div {
position: absolute;
text-align: center;
width: 100%;
height: 50px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
padding: 10px;
}
.b02_slide_in div:nth-child(1) {
color: #000000;
background-color: #ffffff;
}
.b02_slide_in div:nth-child(2) {
background-color: #000000;
transition: top 0.1s ease;
-webkit-transition: top 0.1s ease;
-moz-transition: top 0.1s ease;
top: -50px;
}
.b02_slide_in div:nth-child(3) {
color: #ffffff;
transition: opacity 0.1s ease;
-webkit-transition: opacity 0.1s ease;
-moz-transition: opacity 0.1s ease;
opacity: 0;
}
.b02_slide_in:hover div:nth-child(2) {
top: 0px;
transition: top 0.1s ease;
-webkit-transition: top 0.1s ease;
-moz-transition: top 0.1s ease;
}
.b02_slide_in:hover div:nth-child(3) {
opacity: 1;
transition: opacity 0.1s ease;
-webkit-transition: opacity 0.1s ease;
-moz-transition: opacity 0.1s ease;
}
/* ### ### ### 03 */
.b03_skewed_slide_in {
overflow: hidden;
border: #000000 solid 1px;
}
.b03_skewed_slide_in div {
position: absolute;
text-align: center;
width: 100%;
height: 50px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
padding: 10px;
}
.b03_skewed_slide_in div:nth-child(1) {
color: #000000;
background-color: #ffffff;
}
.b03_skewed_slide_in div:nth-child(2) {
background-color: #000000;
width: 230px;
transition: all 0.2s ease;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
transform: translate(-250px, 0px) skewX(-30deg);
-webkit-transform: translate(-250px, 0px) skewX(-30deg);
-moz-transform: translate(-250px, 0px) skewX(-30deg);
}
.b03_skewed_slide_in div:nth-child(3) {
color: #ffffff;
left: -200px;
transition: left 0.2s ease;
-webkit-transition: left 0.2s ease;
-moz-transition: left 0.2s ease;
}
.b03_skewed_slide_in:hover div:nth-child(2) {
transition: all 0.5s ease;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
transform: translate(-15px, 0px) skewX(-30deg);
-webkit-transform: translate(-15px, 0px) skewX(-30deg);
-moz-transform: translate(-15px, 0px) skewX(-30deg);
}
.b03_skewed_slide_in:hover div:nth-child(3) {
left: 0px;
transition: left 0.30000000000000004s ease;
-webkit-transition: left 0.30000000000000004s ease;
-moz-transition: left 0.30000000000000004s ease;
}
/* ### ### ### 04 */
.b04_3d_tick {
perspective: 500px;
-webkit-perspective: 500px;
-moz-perspective: 500px;
perspective-origin: center top;
-webkit-perspective-origin: center top;
-moz-perspective-origin: center top;
}
.b04_3d_tick div {
position: absolute;
text-align: center;
width: 100%;
height: 50px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
padding: 10px;
border: #000000 solid 1px;
}
.b04_3d_tick div:nth-child(1) {
color: #000000;
background-color: #ffffff;
transition: all 0.2s ease;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
}
.b04_3d_tick div:nth-child(2) {
color: #ffffff;
background-color: #000000;
transform: rotateX(90deg);
-webkit-transform: rotateX(90deg);
-moz-transform: rotateX(90deg);
transition: all 0.2s ease;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
transform-origin: left top;
-webkit-transform-origin: left top;
-moz-transform-origin: left top;
}
.b04_3d_tick:hover div:nth-child(1) {
transition: all 0.2s ease;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
background-color: rgba(0, 0, 0, 0.5);
}
.b04_3d_tick:hover div:nth-child(2) {
transition: all 0.2s ease;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
transform: rotateX(0deg);
-webkit-transform: rotateX(0deg);
-moz-transform: rotateX(0deg);
}
/* ### ### ### 05 */
.b05_3d_roll {
perspective: 500px;
-webkit-perspective: 500px;
-moz-perspective: 500px;
}
.b05_3d_roll div {
position: absolute;
text-align: center;
width: 100%;
height: 50px;
padding: 10px;
border: #000000 solid 1px;
pointer-events: none;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
}
.b05_3d_roll div:nth-child(1) {
color: #000000;
background-color: #000000;
transform: rotateX(90deg);
-webkit-transform: rotateX(90deg);
-moz-transform: rotateX(90deg);
transition: all 0.2s ease;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
transform-origin: 50% 50% -25px;
-webkit-transform-origin: 50% 50% -25px;
-moz-transform-origin: 50% 50% -25px;
}
.b05_3d_roll div:nth-child(2) {
color: #000000;
background-color: #ffffff;
transform: rotateX(0deg);
-webkit-transform: rotateX(0deg);
-moz-transform: rotateX(0deg);
transition: all 0.2s ease;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
transform-origin: 50% 50% -25px;
-webkit-transform-origin: 50% 50% -25px;
-moz-transform-origin: 50% 50% -25px;
}
.b05_3d_roll:hover div:nth-child(1) {
color: #ffffff;
transition: all 0.2s ease;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
transform: rotateX(0deg);
-webkit-transform: rotateX(0deg);
-moz-transform: rotateX(0deg);
}
.b05_3d_roll:hover div:nth-child(2) {
background-color: #000000;
transition: all 0.2s ease;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
transform: rotateX(-90deg);
-webkit-transform: rotateX(-90deg);
-moz-transform: rotateX(-90deg);
}
/* ### ### ### 06 */
.b06_3d_swap {
perspective: 500px;
-webkit-perspective: 500px;
-moz-perspective: 500px;
transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
}
<div class="back">
<div class="button_base b02_slide_in">
<div>01_Button</div>
<div></div>
<div>01_Button</div>
</div>
</div>
<div class="back">
<div class="button_base b03_skewed_slide_in">
<div>01_Button</div>
<div></div>
<div>01_Button</div>
</div>
</div>
<div class="back">
<div class="button_base b04_3d_tick">
<div>01_Button</div>
<div>01_Button</div>
</div>
</div>
<div class="back">
<div class="button_base b05_3d_roll">
<div>02_Button</div>
<div>01_Button</div>
</div>
</div>
I want to use these buttons as link for download button. How to use it for setting hyper link in these buttons ? Any help will be appreciated.
You can replace button with an a tag and style it like a button, like this:
01_Button
EDIT: Sorry I didn't see you were using divs. Add you link inside the div, like this:
<div class="button-style">01_Button</div>
<div class="button_base b02_slide_in">
<div>01_Button</div>
<div></div>
<div><a class="link" href="#">01_Button</a></div>
</div>
<style>
.link:hover
{
color:#fff;
text-decoration: none;
}
</style

Draw line from transformed canvas to another transformed canvas

Here I am trying to draw line between two different points on different canvas positioned using transform CSS. CSS places canvases with some angle between them
I have multiple canvases positioned using transform properties of css,
example:
var c1=document.getElementById('c1').getBoundingClientRect();
offsetX0=c1.left;
offsetY0=c1.top;
c2=document.getElementById('c2').getBoundingClientRect();
offsetX1=c2.left;
offsetY1=c2.top;
var x0=10+offsetX0;
var y0=30+offsetY0;
var x1=60+offsetX1;
var y1=60+offsetY1;
var w=Math.abs(x1-x0);
var h=Math.abs(y1-y0);
var overlay=document.getElementById('overlay');
overlay.width=w+2;
overlay.height=h+2;
overlay.style.left=(x0-1)+'px';
overlay.style.top=(y0-1)+'px';
var context=overlay.getContext('2d');
context.beginPath();
context.moveTo(1,1);//point on canvas1
context.lineTo(overlay.width-1,overlay.height-1);//point on canvas2
context.lineWidth=1;
context.stroke();
#overlay{position:absolute;bottom:5px;pointer-events:none;border:none;}
#container
{
width:500px;
height: 340px;
margin:80px auto;
position:relative;
perspective: 3500px;
perspective-origin: 100px -150px;
}
#shape {
width: 100%;
height: 100%;
position: absolute;
transform-style: preserve-3d;
}
.ready #shape {
-webkit-transition: -webkit-transform 1s;
-moz-transition: -moz-transform 1s;
-o-transition: -o-transform 1s;
transition: transform 1s;
}
.ready #shape canvas
{
-webkit-transition: opacity 1s, -webkit-transform 1s;
-moz-transition: opacity 1s, -moz-transform 1s;
-o-transition: opacity 1s, -o-transform 1s;
transition: opacity 1s, transform 1s;
}
#shape canvas
{
display: block;
position: absolute;
width: 500px;
height: 340px;
left: 0px;
top: 0px;
border: 1px solid gray;
line-height: 116px;
font-size: 80px;
font-weight: bold;
color: green;
text-align: center;
}
#shape
{
border: 1px;
background-color: rgba(255, 255, 255, 0);
}
.ring {
position: absolute;
width: 500px;
height:340px;
text-align: center;
font-family: Times, serif;
font-size: 124pt;
color: black;
background-color: #F0F0F0;
}
.ring > .r1
{
translateZ(-144px);
transform: rotateY(0deg) translateZ(-250px);
background: transparent;
z-index: 1;
}
.ring > .r2
{
translateZ(-144px);
transform: rotateY(270deg) translateZ(-250px);
background: transparent;
z-index: 1;
}
.ring > .r3
{
translateZ(-144px);
transform: rotateY(0deg) translateZ(-250px);
background: transparent;
z-index: 1;
}
<div class="ready">
<div id="container">
<div id="shape" class="ring" class="panels-backface-invisible">
<canvas id="c1" class="ring r1" width="500" height="340"></canvas>
<canvas id="c2" class="ring r2"></canvas>
</div>
</div>
</div>
<canvas id="overlay"></canvas>
But when drawing, it does not match points specified on canvas and line drawn between points because canvas is transformed.

CSS Hover Effects Persisting When I Don't Want It To

I've got a div styled to be a circle with an image and some text centered inside of it.
Without hovering, the circle and image are shown while the text is transparent.
When hovering, the circle border starts flashes (webkit animation), the image's opacity is lowered, and the text becomes visible.
When writing/testing this code in Firefox, everything works as desired, but on Chrome, the changes from the hover effect persist and I don't want them to (namely, the image opacity stays lowered, and the text remains visible. Continuing to hover on the div, however, makes the border flash as intended.
I've got all the correct webkit/moz/ms/o transitions and animations, but I can't seem to figure out what's going wrong (or if this is just one of the deficiencies that comes from using Chrome).
My code for the div and all its elements is:
<div class='players'>
<div class='row'>
<div class='span6'>
<div class='matchup'>
<p class='team'>SOMETEAMNAME</p>
<p class='name'>SOMENAME</p>
<img src='SOMEIMAGE'>
</div>
</div>
</div>
</div>
My CSS code:
.matchup {
width: 250px;
height: 250px;
background: transparent;
border: 1px solid #ff6600;
border-radius: 125px;
display: block;
margin-left: auto;
margin-right: auto;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
-webkit-transition: 0.5s ease;
-moz-transition: 0.5s ease;
-ms-transition: 0.5s ease;
-o-transition: 0.5s ease;
transition: 0.5s ease;
}
.matchup img {
position: static;
margin-top: -22%;
opacity: 1;
-webkit-transition: 0.5s ease;
-moz-transition: 0.5s ease;
-ms-transition: 0.5s ease;
-o-transition: 0.5s ease;
transition: 0.5s ease;
}
.matchup p {
font-family: 'Lobster', cursive;
position: relative;
text-align: center;
top: 50%;
color: transparent;
-webkit-transition: 0.5s ease;
-moz-transition: 0.5s ease;
-ms-transition: 0.5s ease;
-o-transition: 0.5s ease;
transition: 0.5s ease;
}
.team {
font-size: 25px;
}
.name {
font-size: 45px;
}
.map {
font-size: 15px;
margin-top: -70%;
}
.matchup:hover {
-webkit-animation: matchup-active 1s infinite;
-moz-animation: matchup-active 1s infinite;
-ms-animation: matchup-active 1s infinite;
-o-animation: matchup-active 1s infinite;
animation: matchup-active 1s infinite;
p {
color: #ff6600;
}
img {
opacity: 0.2;
}
}
#-webkit-keyframes matchup-active {
0% {
border: 1px solid #ff6600;
}
50% {
border: 1px solid transparent;
}
100% {
border: 1px solid #ff6600;
}
}
#-moz-keyframes matchup-active {
0% {
border: 1px solid #ff6600;
}
50% {
border: 1px solid transparent;
}
100% {
border: 1px solid #ff6600;
}
}
#-o-keyframes matchup-active {
0% {
border: 1px solid #ff6600;
}
50% {
border: 1px solid transparent;
}
100% {
border: 1px solid #ff6600;
}
}
#keyframes matchup-active {
0% {
border: 1px solid #ff6600;
}
50% {
border: 1px solid transparent;
}
100% {
border: 1px solid #ff6600;
}
}
EDIT:
Updated with a jsfiddle: http://jsfiddle.net/sicophrenic/qvJ94/
It's not styled perfectly (i.e. images and stuff aren't centered), but the problem I'm having shows up (in Chrome and works fine in Firefox).
on .matchup add color:transparent;
on .matchup:hover add color: #ff6600;
on .matchup p add color: inherit;
because .matchup:hover p is not a valid selector.
here is a fiddle

Resources