我试图创建内容框,每个内容框都有不同的文字颜色,但我无法做到这一点
这是代码
.content-box-blue,
.content-box-green, {
margin: 0 0 25px;
overflow: hidden;
padding: 20px;
}
.content-box-blue {
color: #0000FF;
background-color: #d8ecf7;
border: 1px solid #afcde3;
}
.content-box-green {
color: #088A08;
background-color: #d9edc2;
border: 1px solid #b2ce96;
}
答案 0 :(得分:1)
.content-box-blue,.content-box-green, { you have used comma before { brackets thats why css is not working .
CSS:
.content-box-blue,
.content-box-green {
margin: 0 0 25px;
overflow: hidden;
padding: 20px;
height: 100px;
width: 200px;
}
.content-box-blue {
color: #0000FF;
background-color: #d8ecf7;
border: 1px solid #afcde3;
}
.content-box-green {
color: #088A08;
background-color: #d9edc2;
border: 1px solid #b2ce96;
}
**HTML:**
<div class="content-box-blue">
This text box is
</div>
<div class="content-box-green">
This text box is
</div>