如何解决为什么背景图像不适用于输入?
我已将我的图像输入设置为带有背景图像的提交输入:
<input title="Search" class="searchButton" id="searchButton" type="submit" style="background-image: url(https://dinblox.org/cdn/png/search.png); height: 34px; width: 34px;" value="">
但是它只是显示为 this
请告诉我如何解决这个问题。
解决方法
尝试使用 background-size
、background-repeat
和 background-position
。
.searchButton {
width: 34px;
height: 34px;
background-color: black;
border: 0px;
background-image: url(https://dinblox.org/cdn/png/search.png);
background-size: 28px;
background-repeat: no-repeat;
background-position: center;
}
<input title="Search" class="searchButton" id="searchButton" type="submit" value="">
或内联 CSS:
<input title="Search" class="searchButton" id="searchButton" type="submit" value="" style="width:34px;height:34px;background-image: url(https://dinblox.org/cdn/png/search.png);background-size: 28px;background-position: center;background-repeat: no-repeat;">
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。