0

I declared a div after header and nav, and styled it then I declared another in div inside that, now I'm trying to style this inner div but it doesn't work I don't know why

here is html code

 <body>
<div id="body-div">
<header>
<img id="header" src="header.jpg">
</header>
   <nav>
         <a  class="nav-a" href="#">Home</a>
         <a class="nav-a" href="#">About</a>
         <a class="nav-a" href="#">Blog</a>
         <a class="nav-a" href="#">Contact</a>
      </nav>

   <div id="2nd-div">

  </div>
   </div>

</body>

and this is my css code

<style type="text/css">
    body{
        background-color: #A09E85
    }
    #header{
        width:1310px;
        height: 250px;  
        border-bottom-left-radius: 10px;
        border-bottom-right-radius: 10px;
        margin-left: 10px;

    }
    #body-div{
        background-color: #D4D3B7;
        width: 1328px;
        height: 1000px;
        margin-top:-10px;
    }
    a.nav-a{
        text-decoration: none;
        padding: 20px;
        color: black;
        font-weight: bold;
    }

    #2nd-div{
        background-color: #F9F8F4;
        width:1310px;
        height: 900px;
        margin-left: 10px;
        margin-right: 10px;
    }




</style>

the #2nd-div doesn't take the style
what is wrong with my code?

Nima Bahar
  • 13
  • 6
  • 3
    invalid ID name ... don't start with number [even if it can be allowed on HTML5] – Temani Afif May 24 '18 at 14:21
  • An id name can't start with a number. I'd recommend to call it something different and also not give it a specific number like second because what if you decide to put another div on top, then it won't be the 2nd div anymore. – Naomi May 24 '18 at 14:23
  • wow thank you very much guys you saved me – Nima Bahar May 24 '18 at 14:26

0 Answers0