html - 动画结束后短暂的卡顿

标签 html css

当悬停在链接元素上时,我使用 CSS3 制作了发光和填充扩展效果。然而,当动画结束时,您继续将鼠标悬停在它上面时,会出现短暂的卡顿,并且内边距会稍微延伸一些。

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);
}

和 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>

和代码笔:http://codepen.io/abs26/pen/RNdbzj

最佳答案

发生这种情况是因为 font-weight:bold。字体宽度增加并且没有相应的过渡。

您可以使用 text-shadow 而不是 font-weight 在悬停时突出显示链接:

文字阴影: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;**
}

您可以重复文本阴影来巩固您认为合适的“边框”。例如:text-shadow: 0 0 1px AliceBlue, 0 0 1px AliceBlue, 0 0 1px AliceBlue;

关于html - 动画结束后短暂的卡顿,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29288223/

相关文章:

javascript - 使用独特的选择器关闭所有打开的提示工具

css - Kendo UI Tabstrip 和 jQuery Tooltipster 重叠问题

javascript - 在 LightSwitch HTML5 客户端中为超链接加下划线

html - Linkwithin-如何删除?

html - CSS Div 链接文本下划线悬停

java - Jquery .attr(attrname) 并不总是有效?

css - Firefox 中的下拉菜单

html - 逐渐减小嵌套节点的字体大小

html - 在 Elasticsearch 中存储 HTML 文档

html - 是否可以在没有 javascript 的情况下使用带有下 zipper 接的导航栏?