我尝试将css调用到div类内部div类中。请解决我的代码?
Html代码:
<div class="underpost_3c_head">
<div class="underpost_3c_head_title">hhh1 </div>
<div class="underpost_2nd_page_head_title">
<div class="2nd_page_head_result">hhh</div>
<div class="2nd_page_head_result">hhh</div>
<div class="2nd_page_head_result">hhh</div>
<div class="2nd_page_head_result">hhh</div>
</div>
<div class="underpost_3rd_page_head_title">
<div class="3rd_page_head_result">hhh</div>
<div class="3rd_page_head_result">hhh</div>
<div class="3rd_page_head_result">hhh</div>
<div class="3rd_page_head_result">hhh</div>
</div>
</div>
我如何选择所有课程? 我试试:
.2nd_page_head_result {
width: 110px;
padding-left:5px;
}
和
div.2nd_page_head_result {
padding-left:5px;
}
但它没有用。请帮我解决这个问题。
答案 0 :(得分:0)
您无法使用数字启动班级名称和/或ID。
.nd_page_head_result {
width: 110px;
padding-left: 5px;
background: wheat;
}
&#13;
<div class="underpost_3c_head">
<div class="underpost_3c_head_title">hhh1</div>
<div class="underpost_2nd_page_head_title">
<div class="nd_page_head_result">hhh</div>
<div class="nd_page_head_result">hhh</div>
<div class="nd_page_head_result">hhh</div>
<div class="nd_page_head_result">hhh</div>
</div>
<div class="underpost_3rd_page_head_title">
<div class="3rd_page_head_result">hhh</div>
<div class="3rd_page_head_result">hhh</div>
<div class="3rd_page_head_result">hhh</div>
<div class="3rd_page_head_result">hhh</div>
</div>
</div>
&#13;
然而,有一种解决方法:
[class="3rd_page_head_result"] {color: red;}
https://benfrain.com/when-and-where-you-can-use-numbers-in-id-and-class-names/