Here I have an animation that makes a blinking border next to the title you're hovering on:
#link_list a:hover {
border-left: 10px solid #E3E3E3;
animation: blink 1s infinite;
-webkit-animation: blink 1s infinite;
-moz-animation: blink 1s infinite;
-o-animation: blink 1s infinite;
animation-delay: 0.5s;
-webkit-animation-delay: 0.5s;
}
#keyframes blink {
0% { border-left: 10px solid rgba(215, 215, 215, 1); }
50% { border-left: 10px solid rgba(215, 215, 215, 0); }
100% { border-left: 10px solid rgba(215, 215, 215, 1); }
}
Now, the problem is that the transition doesn't support the animation.
I already fixed it for the transition-in with the animation-delay property, but the transition-out doesn't work because the animation is running.
FIDDLE
This is a bit of a hack way to do this, but you can accomplish the effect you are looking for with positioning.
Basically, instead of setting the border width to be 0px when the links are not being hovered, set the width to 10px (the same as onHover) and use relative positioning to move the element to the left 10px, as if the border is not there.
Then set the animation of the left property to be 0.2s ease and set left: 0 in the :hover state.
#link_list a{
border-left: 10px solid transparent;
transition: border-left 0.2s ease, border-bottom 0.2s ease, border-right 0.2s ease, left 0.2s ease;
position: relative;
left: -10px;
}
#link_list a:hover {
left: 0px;
}
With this, you can remove the transition-delay as well.
JSFiddle
You should use left: -10px; property instead of transition-delay: 0.2s; animation properties, add this properties into things #link_list a{ },
Check this Demo jsFiddle
CSS
#link_list a{
color: inherit;
text-decoration: none;
border-left: 0px solid transparent;
border-width: 0px;
transition: border-left 0.2s ease, border-bottom 0.2s ease, border-right 0.2s ease;
left: -10px; // ADD THIS NEW
}
Related
What would be the code for a webkit css animation that traces out the border around an element (say a div or a heading) from one corner, around the entire element ending up back at the original corner?
In layman's terms, if someone was drawing a rectangle by pencil in one single line around the element.
The effect must be permanent and not just occur when the user hovers over the element.
Maybe something like this?
#keyframes pencil {
0% {
transition: border-color 0.5s ease-in-out 0.25s;
border-color: #000 #fff #fff #fff;
top:0%;
left: 0%;
}
25% {
transition: border-color 0.5s ease-in-out 0.25s;
border-color: #fff #000 #fff #fff;
top:0%;
right: 100%;
}
50% {
transition: border-color 0.5s ease-in-out 0.25s;
border-color: #fff #fff #000 #fff;
top:100%;
right: 100%;
}
75% {
transition: border-color 0.5s ease-in-out 0.25s;
border-color: #fff #fff #fff #000;
top:100%;
right: 0%;
}
100% {
transition: border-color 0.5s ease-in-out 0.25s;
border-color: #fff #fff #fff #fff;
top:0%;
right: 0%;
}
}
.pencil-border {
border: 2px solid #fff;
animation: pencil 2s infinite linear;
}
<div class="pencil-border">
Test
</div>
the effect im after is the following: the button doesn't look like a button (ie border: none) and when clicked I want the focus outline to fade out after n seconds.
How can i achieve that?
Thanks
Simply adding a transition. Important to remember is that you need to transition the outline-color, not the outline.
.no-button {
margin:15px;
border:none;
}
.no-button:focus {
outline-color:transparent;
-webkit-transition: outline-color .7s ease-out 1s;
-moz-transition: outline-color .7s ease-out 1s;
-o-transition: outline-color .7s ease-out 1s;
transition: outline-color .7s ease-out 1s;
}
<button class="no-button">This is no button</button>
The first time (.7s) is the duration, the second one (1s) is the delay.
For getting such an effect border is better than outline and I played a little bit with it for you and the result is as follow:
button {
background: border-box linear-gradient(#841518, #4C0C00) no-repeat;
font-size: x-large;
font-family: Sans;
border: none;
transition: border-color 0.7s 0.2s;
border-width: 15px;
box-sizing: border-box;
height: 80px;
width: 220px;
display: inline-block;
}
button:focus {
border-style: solid;
border-color: transparent;
outline: none;
}
<button type="button">Click here</button>
I have this bar graph made with html/css/jquery, when you hover a bar you get more info. This "pop up" only gets on top of the previous bars but no the following ones?
Why?
HTML
<li>
<div style='height:87%' class='graphs'>
<span class='info'>2014-05-07 downloads: 461</span>
</div>
</li>
CSS
#bars li {
display: table-cell;
vertical-align: bottom;
z-index:1;
position:relative;
}
#bars li .graphs{
border-radius: 5px 0px 0 0;
-webkit-box-shadow: rgba(0, 0, 0, 0.6) 0 1px 1px;
box-shadow: rgba(0, 0, 0, 0.8) 0 1px 1px;
background-image: linear-gradient(to bottom, #32CD32 0%, #228B22 100%);
background-clip: content-box;
width:100%;
-moz-box-sizing: border-box;
box-sizing: border-box;
display:none;
opacity: 0.8;
-webkit-transition: opacity 1s ease-in;
-moz-transition: opacity 1s ease-in;
-ms-transition: opacity 1s ease-in;
-o-transition: opacity 1s ease-in;
transition: opacity 1s ease-in;
z-index:1;
cursor:pointer;
position:relative;
}
#bars li .graphs:hover{
-webkit-transition: margin-bottom 1s,opacity 1s ease-out, -webkit-transform 1s; /* For Safari 3.1 to 6.0 */
transition: margin-bottom 1s, opacity 1s ease-out, transform 1s;
margin-bottom: 20px;
filter: alpha(opacity=100);
opacity: 1;
}
#bars li .graphs span.info{
display:none;
padding: 5px;
border-radius: 3px 3px 3px 3px;
background-color:rgba(240, 232, 232, 0.9);
position:absolute;
top:0px;
left:-100px;
z-index:3;
width: 100px;
box-shadow: rgba(0, 0, 0, 0.8) 0 1px 3px;
}
More info here:
http://jsfiddle.net/4PNmD/2/
All of #bar's li children share the same z-index. So as they're being added in the DOM, they're seemingly stacking on top of one another semantically. You could add
#bars li:hover {
z-index: 10;
}
to get it function properly.
The issue is due to each one of your li's establishing its own stacking context. z-index only is used for elements within the same context.
The reason that the box appears above bars to the left of its own bar, and is hidden under bars to the right, is because ordering comes into play. The li's are in the same stacking context - the children across li's are not! And since the li's all have the same z-index, the specification indicates that the order of the elements determine which element gets stacked over the other.
ref: http://philipwalton.com/articles/what-no-one-told-you-about-z-index/
I have a textarea and on focus I would like to animate both Border Shadow and Border Radius, the problem is if I try to combine those two together Border Radius animation does not work it just "Pops Out" without any animation. I have created a Fiddle to show you my problem.
Code looks like this:
textarea{
display: block;
padding-left: 3px;
padding-right: 3px;
border: 1px solid #e7e7e7;
box-shadow: 0 0 3px #e7e7e7;
background: none;
color: #6b6b6b;
max-width: 100%;
}
textarea:focus {
outline: none;
box-shadow: 0 0 25px #9ecaed;
-webkit-transition: box-shadow linear 1s;
transition: box-shadow linear 1s;
border-color: #9ecaed;
transition : border 500ms ease-out;
-webkit-transition : border 500ms ease-out;
-moz-transition : border 500ms ease-out;
-o-transition : border 500ms ease-out;
}
CSS doesn't work the way you're expecting it to.
After setting transition: box-shadow linear 1s; you are overriding it with transition : border 500ms ease-out;. You have to set them both on the same property.
Like so (Fiddle):
textarea:focus {
outline: none;
box-shadow: 0 0 25px #9ecaed;
border-color: #9ecaed;
transition: box-shadow linear 1, border 500ms ease-out;
-webkit-transition: box-shadow linear 1, border 500ms ease-out;
-moz-transition: box-shadow linear 1, border 500ms ease-out;
-o-transition: box-shadow linear 1, border 500ms ease-out;
}
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