简体   繁体   English

为什么不工作背景颜色? - CSS

[英]Why is not working background-color? - CSS

I have made a list with bootstrap and I would like to change the background-color of each item.我已经用 bootstrap 制作了一个列表,我想更改每个项目的背景颜色。 I have this:我有这个:

 .list-group { background-color: black; }
 <div class="list-group"> <a href="#" class="list-group-item list-group-item-action"> <picture> <img class="imagenLista" src="myimage"> </picture> <p> <br>sometext </p> </a> </div>

I am using chromium and firefox and I have the same problem, but the curious thing is that in JSBin, it works.我正在使用铬和火狐,我有同样的问题,但奇怪的是,在 JSBin 中,它可以工作。 I am using sublime text(I don't know if it is important) also.我也在使用崇高的文字(我不知道它是否重要)。

You should target list-group-item not list-group您应该针对list-group-item而不是list-group

Here's a working example (with bootstrap imported)这是一个工作示例(导入了引导程序)

Please add your css to list-group-item请将您的 css 添加到 list-group-item

.list-group{
background-color: black;
}
a.list-group-item.list-group-item-action {
background-color: #000;
}

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

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