Reputation: 91
I made a glow and padding extension effect when hovering over link elements usign CSS3. However when the animation finishes, and you continue hovering over it, there's a short stutter and the padding extends a bit more.
The CSS:
#links {
background: rgba(34,34,34,0.75);
max-width: 400px;
padding: 0px 10px 2px 10px;
margin: 0 auto;
position: relative;
right: -100px;
bottom: -100px;
clear: both;
z-index: -1;
}
#links h3 {
padding: 0px;
font-size: 50px;
font-family: 'Raleway', sans-serif;
font-weight: normal;
color: whitesmoke;
}
#links ul {
padding: 0px;
}
#links li {
display:inline;
padding-right: 15px;
}
#links li a:link {
font-family: 'Raleway', sans-serif;
font-weight: normal;
color: whitesmoke;
text-decoration: none;
/*Transitions*/
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
}
#links li a:visited {
font-family: 'Raleway', sans-serif;
font-weight: normal;
color: whitesmoke;
text-decoration: none;
/*Transitions*/
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
}
#links li a:active {
font-family: 'Raleway', sans-serif;
font-weight: bold;
color: AliceBlue;
text-decoration: none;
}
#links li a:hover {
font-family: 'Raleway', sans-serif;
font-weight: bold;
color: AliceBlue;
text-decoration: none;
padding: 6px;
/*Glow*/ -webkit-box-shadow: 0px 0px 20px rgba(255,255,255,0.8);
}
And the HTML:
<div id="links">
<h3 id="subtitle">Links</h3>
<ul>
<li><a href="">Resume</a></li>
<li><a href="">LinkedIn</a></li>
<li><a href="">GitHub</a></li>
</ul>
</div>
And codepen: http://codepen.io/abs26/pen/RNdbzj
Upvotes: 0
Views: 92
Reputation: 71
That happens because of font-weight:bold. The width of the font increases and there isn't a transition for that.
You could use text-shadow instead of font-weight to highlight the link when hovering it:
text-shadow: 0 0 1px AliceBlue, 0 0 1px AliceBlue;
#links li a:hover {
font-family: 'Raleway', sans-serif;
color: AliceBlue;
text-decoration: none;
padding: 6px;
**text-shadow: 0 0 1px AliceBlue, 0 0 1px AliceBlue;**
}
You could repeat the text-shadows to solidify the "border" as you see fit. For example: text-shadow: 0 0 1px AliceBlue, 0 0 1px AliceBlue, 0 0 1px AliceBlue;
Upvotes: 1