gpt4 book ai didi

html - CSS:背景图像不显示

转载 作者:行者123 更新时间:2023-11-28 04:01:41 25 4
gpt4 key购买 nike

我做错了什么?

CSS:

.submit{
padding-left:10px;
margin:0;
border:0;
outline: 0;
height:32px;
padding-right:32px;
}
.green-btn {
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#61A801), to(#8CC400));
background: -webkit-linear-gradient(top, #8CC400, #61A801);
background: -moz-linear-gradient(top, #8CC400, #61A801);
background: -ms-linear-gradient(top, #8CC400, #61A801);
background: -o-linear-gradient(top, #8CC400, #61A801);
color: #fff;
font-family: verdana;
font-size: 13px;
font-weight: normal;
border-radius:5px;
}
.clipboard{
background-image: url(http://cdn1.iconfinder.com/data/icons/opensourceicons/32/Scissors.png) no-repeat right center;
}

HTML:

<input type="submit" value="Copy" class="submit green-btn clipboard">​

JSFiddle: http://jsfiddle.net/77NYA/

最佳答案

您不能在 background-image 中指定位置和重复值属性(property)。您可以指定图像的 URL。您必须像这样将它们分开:

.clipboard {
background-image: url(http://cdn1.iconfinder.com/data/icons/opensourceicons/32/Scissors.png);
background-repeat: no-repeat;
background-position: right center;
}

另请注意:某些浏览器(我不知道是哪些浏览器)不允许将渐变和背景图像组合在一起。


这是使用 <button> 的替代解决方案用<img>里面:

<button type="submit" value="Copy" class="submit green-btn">
<img src="http://cdn1.iconfinder.com/data/icons/opensourceicons/32/Scissors.png" alt="[scissors]" />
Copy
</button>​
.submit{
padding-left:10px;
margin:0;
border:0;
outline: 0;
height:32px;
line-height:32px;
padding-right:10px;
}
.green-btn {
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#61A801), to(#8CC400));
background: -webkit-linear-gradient(top, #8CC400, #61A801);
background: -moz-linear-gradient(top, #8CC400, #61A801);
background: -ms-linear-gradient(top, #8CC400, #61A801);
background: -o-linear-gradient(top, #8CC400, #61A801);
color: #fff;
font-family: verdana;
font-size: 13px;
font-weight: normal;
border-radius:5px;
}
.green-btn img {
float: right;
margin-left: 10px;
}​

还有 jsFiddle preview .随意调整边距和其他东西,让它看起来更像你想要的样子。

关于html - CSS:背景图像不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9780595/

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