gpt4 book ai didi

css - 如何添加背景图片和渐变背景

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

如何在 css 中将背景图像添加到渐变背景。这是我的代码

input.button-add {

font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
color: #ffffff;
padding: 4px 4px;
background: -moz-linear-gradient(
top,
#ff2819 0%,
#ff0d0d);
background: -webkit-gradient(
linear, left top, left bottom,
from(#ff2819),
to(#ff0d0d));
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border: 1px solid #ffffff;
-moz-box-shadow:
0px 1px 1px rgba(000,000,000,0.5),
inset 0px 0px 2px rgba(255,255,255,0.7);
-webkit-box-shadow:
0px 1px 1px rgba(000,000,000,0.5),
inset 0px 0px 2px rgba(255,255,255,0.7);
box-shadow:
0px 1px 1px rgba(000,000,000,0.5),
inset 0px 0px 2px rgba(255,255,255,0.7);

这可能吗?如果可能的话怎么办?

最佳答案

为什么不呢?只需添加任意数量的 background-image(渐变也是图像),用逗号分隔它们。此外,为所有这些指定 background-positionbackground-repeat

这是您的代码,其中包含一张图片背景和一张渐变背景:

input.button-add {
color: #ffffff;
padding: 4px 4px;
border: 1px solid #ffffff; border-radius: 5px;
display: inline-block;
width: 120px; height: 64px;
box-shadow: 0px 1px 1px rgba(000, 000, 000, 0.5), inset 0px 0px 2px rgba(255, 255, 255, 0.7);

background-image:
url('http://lorempixel.com/16/16'),
-webkit-gradient(linear, left top, left bottom, from(#ff2819), to(#fff));

background-position: 4px center, center center;
background-repeat: no-repeat, no-repeat;

}
<input id="btn" type="button" value="Click Here" class="button-add" />

关于css - 如何添加背景图片和渐变背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26755389/

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