Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一张有时显示正常的图像,但有时它只是显示为黑色:
的HTML:
<button class="myImage"> <?php echo _('My image') ?> </button>
CSS:
.myImage { background: url("../img/myImage.png") no-repeat; }
我认为问题来自分配给按钮标签的背景。但是我无法更改按钮标签,所以我该如何规避呢?
为什么不为您使用的所有按钮设置默认背景,这样如果图像失败,它就不会闪烁黑色?
button { background: transparent; } /* Or some solid color that's not black */