【发布时间】:2015-04-09 02:15:13
【问题描述】:
我有一个带有伪元素 ::after 的按钮(标签 a)。问题是元素在 chrome 和 firefox 中看起来不同
谷歌浏览器:
Mozilla 火狐:
我的代码是:
<a class="play_button" href="#">Some link</a>
a.play_button {
background-color: white;
text-decoration: none;
color: #49bf96;
position: relative;
padding: 6px 23px 7px 23px;
border: solid 1px #49bf96;
top: 30px;
right: 12px;
}
a.play_button::after {
background-color: white;
content: url('http://elvis.zitnikcreative.cz/wp-content/themes/elvis_theme/img/darovat_vystoupeni_sipka.png');
width: 10px;
height: 16px;
position: absolute;
display: block;
padding: 7px 9px;
top: -1px;
right: -28px;
font-size: 16px;
color: #49bf96;
border: solid 1px #49bf96;
border-left: solid 1px #49bf96;
}
a.play_button:hover {
background-color: #49bf96;
color: white;
border: solid 1px #1c7d5c;
}
a.play_button:hover::after {
content: url('http://elvis.zitnikcreative.cz/wp-content/themes/elvis_theme/img/bila_sipka.png');
background-color: #49bf96;
color: white;
border: solid 1px #1c7d5c;
border-left: solid 1px #1c7d5c;
}
我该如何解决? JSFiddle 中的答案是最好的。
【问题讨论】:
-
您怀疑是什么导致了这个问题?顺便说一句,在 Safari 中也是如此。
-
我不知道,这就是我在这里问的原因。可能是后元素的填充或高度
-
我做了一个高度为 100% 的小提琴,但图像没有居中 jsfiddle.net/xn8wcgdp/12
标签: css google-chrome firefox pseudo-element