twitter-bootstrap 更改 twitter bootstrap carousel 背景?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22544351/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 20:20:09  来源:igfitidea点击:

change twitter bootstrap carousel background?

csstwitter-bootstrap

提问by user798719

How do you change the Twitter Bootstrap 3 carousel background?

如何更改 Twitter Bootstrap 3 轮播背景?

What I want is a standard red background. Then, each carousel image will be put on top of this red background. Simply changing the tag's css gives me the red background, but then carousel images don't show up.

我想要的是标准的红色背景。然后,每个轮播图像将被放置在这个红色背景之上。简单地更改标签的 css 会给我红色背景,但轮播图像不会显示。

@import url("bootstrap.min.css");

body {
  background-image:url('../images/red_background.png')
}

回答by blurfus

You can try to overwrite .carousellike this:

您可以尝试.carousel像这样覆盖:

    .carousel {
        background: url(http://placehold.it/620x420/ff9900);
        position: relative;
        padding: 10px;     /* Shows as a border around the carousel */
    }

The padding is there only to make the presence of the bg-colour obvious.

填充只是为了使 bg 颜色的存在显而易见。

DEMO

演示

回答by Laura

.carousel{ background-color: red }

.carousel{ 背景颜色:红色 }