Html 在web上使用多种颜色的背景
抱歉,如果标题有点误导。 我要做的是用浅灰色覆盖索引页面的背景,除了显示我内容的部分Html 在web上使用多种颜色的背景,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,抱歉,如果标题有点误导。 我要做的是用浅灰色覆盖索引页面的背景,除了显示我内容的部分 <div class="col-sm-1"> </div> <div class="col-sm-8"> </div> <div class="col-sm-3"> </div> 我希望col-sm-8是唯一的白色,其余的都是灰色。 我可以使用css将col-sm-8设置为灰色,但我该如何做呢?试试这个 [class*="col-"]
<div class="col-sm-1">
</div>
<div class="col-sm-8">
</div>
<div class="col-sm-3">
</div>
我希望col-sm-8是唯一的白色,其余的都是灰色。
我可以使用css将col-sm-8设置为灰色,但我该如何做呢?试试这个
[class*="col-"] {
background : grey;
}
.col-sm-8{
background: white;
}
好的,[class*=“col-”]
选择器所做的是,它将为以col开头的类属性值提供灰色背景-
您可以通过编写完整的类名来设置单个类的样式。我想您需要如下所示 你可以用相反的方法
div:not(.col-sm-8){
背景颜色:灰色;
}
test1
测试8
测试3
使用自己的样式(内联css)代替引导类
容器
容器
K
K
K
容器
容器
我相信Jinu Kurian提供的答案听起来像是你想要的答案,但如果答案是你想要所有东西都是浅灰色和背景为白色的col-sm-8。这应该行得通
.container{
背景色:灰色;/*根据您的喜好,将其替换为浅灰色的十六进制颜色值*/
}
.col-sm-8{
背景色:白色;
}
同侧耳
同侧耳
同侧耳
您可以使用选择器,如[class*=“col-”]:not(.col-sm-8)
[class*=“col-”]:非(.col-sm-8){
背景颜色:灰色;
}
1
2.
3.
使用您可以使用的内联设计
<div style="color:#0000FF"> //use the div name
也可以单独设置图元的样式
.col-sm-1{
width:100%;
height:100px;
background:grey;
}
.col-sm-8{
width:100%;
height:100px;
background:white;
}
.col-sm-3{
width:100%;
height:100px;
background:grey;
}
但是,如果您在项目中完全使用引导,您必须避免为引导内置类提供样式。您可以只为
col-sm-1
和col-sm-3
使用灰色,对吗?:)是的,Manoj Kumar提供的答案应该有效。html/css/js基本上前端社区比后端和db社区好得多:我相信前端开发人员比后端开发人员多得多。(我不是想冒犯任何后端开发人员。)kim kimm,尽管我已经在许多不同的问题上帮助过你。请不要在这里有偏见。我真的相信这里的很多答案都比我的好得多。此外,这些人中的许多人知道的比我多得多。例如:shijjin有一个工作示例。Jinu Kurian有一个有效的例子。这两个例子比我的要灵活得多。你认为哪一个更好?几乎所有的工作都在进行,不确定哪一个能提供最快的时间你们是心中的第一,但说真的,哪一个能提供最快的时间?
.col-sm-1{
width:100%;
height:100px;
background:grey;
}
.col-sm-8{
width:100%;
height:100px;
background:white;
}
.col-sm-3{
width:100%;
height:100px;
background:grey;
}