gpt4 book ai didi

html - 背景图片加载不正确

转载 作者:太空宇宙 更新时间:2023-11-04 02:56:33 24 4
gpt4 key购买 nike

我尝试向 span 添加背景图片,但由于某种原因,它似乎没有正确加载。 jsfiddle 在下面。

P.S-我知道它有点直截了当“它不起作用的问题”只是卡住了一段时间找不到答案

http://jsfiddle.net/whnb3yf2/46/

<div class="learn">
<a>Learn More</a>
<span></span>
</div>

.learn
{
width: 200px;
height: 60px;
font-family: 'Open Sans',sans-serif;
background-color: transparent;
border:2px solid #fff;
position: relative;
text-align: center;
font-size: 18pt;
line-height:60px;
overflow: hidden;
}

.learn a
{
color: white;
display: block;
transition: all 0.2s ease-in-out;
}
.learn:hover {
background-color: white;
}

.learn:hover a
{
color: black;
margin-left: -20px;
}

.learn span
{
background:url(https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-arrow-forward-128.png) center;
display: block;
width: 9px;
height: 16px;
position: absolute;
top: 22px;
left: 110%;
transition: all 0.2s ease-in-out;
}

.learn:hover span{
left: 80%;
}

body {
background-color: black;
}

最佳答案

您需要将 background-size: 9px 16px; 添加到您的 .learn span 规则中。

.learn {
width: 200px;
height: 60px;
font-family: 'Open Sans',sans-serif;
background-color: transparent;
border:2px solid #fff;
position: relative;
text-align: center;
font-size: 18pt;
line-height:60px;
overflow: hidden;
}
.learn a {
color: white;
display: block;
transition: all 0.2s ease-in-out;
}
.learn:hover {
background-color: white;
}
.learn:hover a {
color: black;
margin-left: -20px;
}
.learn span {
background:url(https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-arrow-forward-128.png) center center;
background-size: 9px 16px;
display: block;
width: 9px;
height: 16px;
position: absolute;
top: 22px;
left: 110%;
transition: all 0.2s ease-in-out;
}
.learn:hover span{
left: 80%;
}
body {
background-color: black;
}
<div class="learn">
<a>Learn More</a>
<span></span>
</div>

关于html - 背景图片加载不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32057202/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com