如何覆盖所有链接效应?
因此,我试图在Shopify上编辑我们商店的主题。我正在用资产下的css.liquid进行。
无论如何,我要做的是我正在尝试覆盖链接悬停的效果(我假设它在主题上)。这是其中的一个示例: https://codepen.io/jstn/pen/pen/pen/pen/pen/pen/mdoozj
've在下面添加了以下HTML代码:
<a href="#" class="a1">Test</a>
在CSS上,我添加了以下内容:
a.a1:hover{
transition: none;
}
当您悬停在链接上时,我想删除那些动画下划线。有办法这样做吗?
非常感谢您!我很感激!
body,html {
margin: 0;
font: bold 14px/1.4 'Open Sans', arial, sans-serif;
background: #000;
}
ul {
margin: 150px auto 0;
padding: 0;
list-style: none;
display: table;
width: 600px;
text-align: center;
}
li {
display: table-cell;
position: relative;
padding: 15px 0;
}
a {
color: #fff;
text-transform: uppercase;
text-decoration: none;
letter-spacing: 0.15em;
display: inline-block;
padding: 15px 20px;
position: relative;
}
a:after {
background: none repeat scroll 0 0 transparent;
bottom: 0;
content: "";
display: block;
height: 2px;
left: 50%;
position: absolute;
background: #fff;
transition: width 0.3s ease 0s, left 0.3s ease 0s;
width: 0;
}
a:hover:after {
width: 100%;
left: 0;
}
@media screen and (max-height: 300px) {
ul {
margin-top: 40px;
}
}
<ul>
<li><a href="#">About</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
So I'm trying to edit the Theme of our store on Shopify. I'm doing it in css.liquid under Asset.
Anyway, what I'm precisely doing is I'm trying to override the effect of a link hover (I'm assuming that it is on the theme). Here's a sample of it: https://codepen.io/jstn/pen/mdoOZJ
I've added the following HTML code below:
<a href="#" class="a1">Test</a>
and on CSS I've added the following:
a.a1:hover{
transition: none;
}
I want to remove those animated underlines when you hover over the links. Is there a way to do this?
Thank you so much in advance! I appreciate it!
body,html {
margin: 0;
font: bold 14px/1.4 'Open Sans', arial, sans-serif;
background: #000;
}
ul {
margin: 150px auto 0;
padding: 0;
list-style: none;
display: table;
width: 600px;
text-align: center;
}
li {
display: table-cell;
position: relative;
padding: 15px 0;
}
a {
color: #fff;
text-transform: uppercase;
text-decoration: none;
letter-spacing: 0.15em;
display: inline-block;
padding: 15px 20px;
position: relative;
}
a:after {
background: none repeat scroll 0 0 transparent;
bottom: 0;
content: "";
display: block;
height: 2px;
left: 50%;
position: absolute;
background: #fff;
transition: width 0.3s ease 0s, left 0.3s ease 0s;
width: 0;
}
a:hover:after {
width: 100%;
left: 0;
}
@media screen and (max-height: 300px) {
ul {
margin-top: 40px;
}
}
<ul>
<li><a href="#">About</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该下划线是用
a:
pseudo-element创建的。为了覆盖它,这应该足够:The underline is being created with the
a:after
pseudo-element. To override it, this should suffice:因此,由于伪元素上的过渡
a:
之后,过渡是引起的。要更改此行为,只是设置过渡:none;
on a:之后,这是我的意思:
So the transition is caused due to the transition on pseudo element
a:after
. To change this behaviour just settransition: none;
on a:afterHere's what I mean: