3

<input name="submit" type="submit" value="Search" class="button search">

是否可以使用background-image:并仍然显示value属性中包含的文本来应用 CSS 渐变?

当我添加背景图像时,它会隐藏文本。

非常感谢任何帮助

编辑

这是与标记匹配的计算样式

    -webkit-appearance: none;
    -webkit-background-clip: border-box;
    -webkit-background-origin: padding-box;
    -webkit-background-size: auto;
    -webkit-border-image: none;
    -webkit-box-align: center;
    -webkit-box-shadow: rgba(255, 255, 255, 0.701961) 0px 0px 6px 0px inset, rgba(0, 0, 0, 0.0980392) 0px 2px 3px 0px;
    -webkit-font-smoothing: antialiased;
    -webkit-rtl-ordering: logical;
    -webkit-transition-delay: 0s;
    -webkit-transition-duration: 0.30000001192092896s;
    -webkit-transition-property: all;
    -webkit-transition-timing-function: linear;
    -webkit-user-select: text;
    background-attachment: scroll;
    background-clip: border-box;
    background-color: transparent;
    background-image: -webkit-linear-gradient(top, #FF8F25 0%, #FF6D00 100%);
    background-origin: padding-box;
    background-position: 0% 0%;
    background-size: auto;
    border-bottom-color: #BE4B00;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    border-bottom-style: solid;
    border-bottom-width: 1px;
    border-left-color: #BE4B00;
    border-left-style: solid;
    border-left-width: 1px;
    border-right-color: #BE4B00;
    border-right-style: solid;
    border-right-width: 1px;
    border-top-color: #BE4B00;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    border-top-style: solid;
    border-top-width: 1px;
    bottom: 10px;
    box-shadow: rgba(255, 255, 255, 0.701961) 0px 0px 6px 0px inset, rgba(0, 0, 0, 0.0980392) 0px 2px 3px 0px;
    box-sizing: border-box;
    color: white;
    cursor: pointer;
    display: block;
    float: right;
    font-family: 'Lucida Grande';
    font-size: 12px;
    font-style: normal;
    font-variant: normal;
    font-weight: 800;
    height: 26px;
    letter-spacing: normal;
    line-height: 26px;
    margin-bottom: 0px;
    margin-left: 0px;
    margin-right: 0px;
    margin-top: 0px;
    max-height: 24px;
    outline-color: white;
    outline-style: none;
    outline-width: 0px;
    overflow-x: hidden;
    overflow-y: hidden;
    padding-bottom: 0px;
    padding-left: 0px;
    padding-right: 0px;
    padding-top: 24px;
    position: absolute;
    right: 8px;
    text-align: center;
    text-indent: 0px;
    text-shadow: none;
    text-transform: uppercase;
    vertical-align: baseline;
    white-space: pre;
    width: 85px;
    word-spacing: 0px

解决了

是一个填充问题将文本向下推。似乎在 Mac 上的 Chrome 中可以应用填充而不影响高度,以便将文本推下视图。

谢谢你们的帮助

4

1 回答 1

3

CSS

input {
background-color: #D28888;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#690707), to(#D28888));
background: -moz-linear-gradient(top, #690707 0%, #D28888 100%);
    border:none; padding:6px 12px; color:#fff; cursor:pointer
}

演示 ​</p>


通过使用background-image

input {
background-image: url(http://alanbooth.net/alap/images/gradient.bmp);
border:none;
padding:6px 12px;
color:#fff;
cursor:pointer
}
​

演示 - 2

于 2012-11-20T06:47:42.353 回答