按钮拒绝播放漂亮的背景图像



我错过了一些明显而简单的东西,但无论我怎么眯着眼睛或盯着屏幕看都看不见。

我想用一个图像作为背景或代替按钮。它没有显示。

标记和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> &nbsp; </label>
     <input type="button" id="switch" name="switch" value="SWITCH!" onclick="switchUnits()"/>
</div>

谢谢你的帮助!

如果图像太大,它可能会被剪切到你看不到的地方。尝试添加:

background-size:75px;

看看它是否出现。(注意,9之前的IE不支持背景大小,所以如果你需要支持旧的IE,最简单的解决方案是缩小图像文件。或者在IE中使用过滤器缩小图像文件)。

最新更新