简体   繁体   English

图像以黑色显示-CSS

[英]Images display in black - CSS

I have an image that sometimes displays normally, but others times it just shows up black: 我有一张有时显示正常的图像,但有时却只是显示为黑色:

The HTML: HTML:

 <button class="myImage">
    <?php echo _('My image') ?>
 </button>

The CSS: CSS:

.myImage { 
    background: url("../img/myImage.png") no-repeat;
}

I think the trouble comes from the background assigned to a button tag. 我认为麻烦来自分配给按钮标签的背景。 But I cant change the button tag so how can I circumvent that? 但是我不能更改按钮标签,所以我该如何规避呢?

为什么不为您使用的所有按钮设置默认背景,这样如果图像出现故障,也不会闪烁黑色?

button { background: transparent; } /* Or some solid color that's not black */

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM