Alal Hossain Alal Hossain - 6 months ago 6
HTML Question

How to call css into div class inner div class?

I try to call css into div class inner div class. Please solve my code?

Html code :

<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>





How can i select all class?
I try :

.2nd_page_head_result {
width: 110px;
padding-left:5px;
}


and

div.2nd_page_head_result {
padding-left:5px;
}


But it's not working. Please help me solve this.

Answer

You cannot start class names and/or IDs with a number.

.nd_page_head_result {
  width: 110px;
  padding-left: 5px;
  background: wheat;
}
<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>

There is a way around this, however:

[class="3rd_page_head_result"] {color: red;}

https://benfrain.com/when-and-where-you-can-use-numbers-in-id-and-class-names/

Comments