是否可以将多个类添加到div元素?我尝试添加完整的和b类,但它不起作用。我可以将多个类添加到div元素吗? (CSS)
#card {
/* default for card */
width: 300px;
height: 50px;
padding: 15px;
background-color: yellow;
box-shadow: 10px 10px 40px grey;
}
#card.g {
background-color: lightgreen;
box-shadow: 10px 10px 40px grey;
}
#card.b {
background-color: lightblue;
box-shadow: 10px 10px 40px grey;
}
#card.full{
width:100%;
height:100%;
padding:10px;
}
<h3 id="card" class="full" class="b">Hi!</h3>
我很抱歉,如果这是一个坏的问题,我是新来编程。
目前,它不工作,因为浏览器只呈现第一类属性。 –
是的,只需添加由空间分隔的不同类。 class =“full b” – anandharshan