html - 3 个链接在悬停时动画,但 1 没有
问题描述
<b><a class="external" href="http://tuleburgpress.com/">Tuleburg Press</a></b>
悬停时链接没有动画。所有其他链接都在悬停时动画。不工作的链接是页面上的断行,这是为什么呢?有任何想法吗?
a.external {
position: relative;
text-decoration: none;
text-transform: uppercase;
font-size: 1.6rem;
font-weight: 700;
letter-spacing: 0.04rem;
line-height: 3rem;
font-family: 'Roboto Mono', monospace;
color: #ff9f43;
}
a.external:before {
content: "";
position: absolute;
background-color: #ff9f43;
width: 100%;
height: 3px;
bottom: -2px;
left: 0;
visibility: hidden;
-webkit-transform: scaleX(0);
transform: scaleX(0);
-webkit-transition: all 0.3s ease-in-out 0s;
transition: all 0.3s ease-in-out 0s;
}
a.external:hover:before {
visibility: visible;
-webkit-transform: scaleX(1);
transform: scaleX(1);
color: #ff9f43;
background-color: #ff9f43;
}
<h2>Brought to you by <b><a class="external" href="http://placeholdermag.com/">Placeholder Magazine</b></a>, the <b><a class="external" href="http://www.arts.ca.gov/">California Arts Council</a></b> and the <b><a class="external" href="http://www.stocktonca.gov/government/boardCom/sArts.html">Stockton Arts Commission</a></b>, <b><a class="external" href="http://tuleburgpress.com/">Tuleburg Press</a></b>, and are proud to announce Stockton's first Zine making workshop series for kids.</h2>
解决方案
这是因为线路被缠绕和损坏。
添加display: inline-block
以确保它在同一行。不要使用<b>
标签,而是使用<strong>
or <span>
with font-weight: bold
。
a.external {
position: relative;
text-decoration: none;
text-transform: uppercase;
font-size: 1.6rem;
font-weight: 700;
letter-spacing: 0.04rem;
line-height: 3rem;
font-family: 'Roboto Mono', monospace;
color: #ff9f43;
display: inline-block;
}
a.external:before {
content: "";
position: absolute;
background-color: #ff9f43;
width: 100%;
height: 3px;
bottom: -2px;
left: 0;
visibility: hidden;
-webkit-transform: scaleX(0);
transform: scaleX(0);
-webkit-transition: all 0.3s ease-in-out 0s;
transition: all 0.3s ease-in-out 0s;
}
a.external:hover:before {
visibility: visible;
-webkit-transform: scaleX(1);
transform: scaleX(1);
color: #ff9f43;
background-color: #ff9f43;
}
<h2>Brought to you by <b><a class="external" href="http://placeholdermag.com/">Placeholder Magazine</a></b>, the <b><a class="external" href="http://www.arts.ca.gov/">California Arts Council</a></b> and the <b><a class="external" href="http://www.stocktonca.gov/government/boardCom/sArts.html">Stockton Arts Commission</a></b>,
<b><a class="external" href="http://tuleburgpress.com/">Tuleburg Press</a></b>, and are proud to announce Stockton's first Zine making workshop series for kids.</h2>
推荐阅读
- azure-data-explorer - 表查询慢 | 哪里 x | 按时间戳排序 | 不同的 a,b,c,d | 桌子大时取 20
- linux - 在 SUSE linux 中检查可升级包列表的命令是什么?
- javascript - Javascript localStorage for-loop的问题
- php - Wordpress 背景革命滑块在升级时中断
- python - Python selenium - AttributeError:'dict'对象没有属性'get_attribute'
- airflow - 使用 SimpleHttpOperator 时请求 api 没有响应(超过 30 分钟)
- c# - GameManagerCompunet.MoveToNextStage()'由于其保护级别而无法访问
- android - 如何使用android的ptrace拦截系统调用(svc)?
- javascript - 显示 [object Object] 而不是标签名称
- vodapay-miniprogram - 有没有办法在整个小应用程序中禁用主页链接?