0

my div inside a parent container should have a margin of 20px from the top from the container instead the margin top applys to the parent container...

#rules-panel {
 background-color:blue;
 width:80%;
 margin:0 auto;
 height:800px;
}

#rules-panel .box {
 margin:20px;
  margin-top:20px; /* why isn't the margin working */
 background-color:red;
}
<div id="rules-panel">

 <div class="box">
  <p>THIS IS div</p>
  <p>THIS IS div</p>
  <p>THIS IS div</p>
  <p>THIS IS div</p>
  <p>THIS IS div</p>
 </div>
  
</div>
AfaqQazi
  • 21
  • 5

0 Answers0