我错过了一些明显而简单的东西,但无论我多么努力地眯着眼睛或盯着屏幕都看不到它。
我想使用图像作为背景或代替按钮。它没有显示。
标记和CSS:
#switch {
background: url("../images/swap.png") no-repeat scroll 0 0 transparent;
color: #000000;
cursor: pointer;
font-weight: bold;
height: 20px;
padding-bottom: 2px;
width: 75px;
}
<div class="conversionFormE" id="switch1">
<label> </label>
<input type="button" id="switch" name="switch" value="SWITCH!" onclick="switchUnits()"/>
</div>
感谢您的帮助!
最佳答案
如果图片太大,可能会被裁剪到您看不到的地步。尝试添加:
background-size:75px;
看看它是否出现。 (请注意,IE 9 之前的版本不支持背景大小,因此如果您需要支持旧版 IE,最简单的解决方案是缩小图像文件。或者在 IE 中使用过滤器将其缩小)。
关于html - 按钮拒绝播放的背景图片不错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17659600/