2017-10-08 36 views
1

我有两个超大屏幕在我的网页,它的HTML:修改只是一个超大屏幕的背景

<div class="jumbotron jumbotron-fluid"> 
    <div class="container"> 
    <h3 class="display-5">TEST</h3> 

,我想改变只有一个颜色,但是当我编辑它的CSS方面的变化。

.jumbotron-fluid{ 
    background-color: red!important; 
} 

我试图把一个id和改变背景使用它,但没有奏效。

+0

向第一个jumbotron添加新类,如'bg-red'。在CSS中添加'.bg-red {background-color:red!important; }'。或者你可以使用这个CSS选择器,只为第一个:'.jumbotron:first-child {background-color:red!important; }' – fen1x

+0

谢谢:)它工作! – Lucky

回答

0

添加我倒是到超大屏幕,没有理由为它不行

#id { 
     background-color: red!important; 
    } 

或添加其他类它

<div class="jumbotron red"></div> 

的CSS

.red { 
     background-color: red!important; 
    } 

或者使用内联风格

 <div class="jumbotron" style="background-color: red"></div> 
0

如果他们在源代码中去了一个又一个,你可以使用

.jumbotron-fluid + .jumbotron-fluid { 
    background-color: red; 
} 

设置背景色为第二个。或者,添加一个新类并为其更改背景颜色。