0

I'm trying to understand what is happening behind the scene. Here is the thing. When I gave the first dive width and padding-bottom or top, it takes effect and box is showing up. So I'm assuming that I have chosen the width and then change the height by padding and it's working in this way. However, with this idea, I thought that by giving height and padding-left or right it should work the same but it doesn't. So I really appreciate if someone explains it to me.

first div:

first box:

second div:

enter image description here

.square{
  background-color: red;
  width: 30%;
  padding-bottom: 30%;
  float: left;
  margin: 1.66%;
}
.square2{
  background-color: blue;
  height: 30%;
  padding-left: 30%;
  float: left;
  margin: 1.66%;
}
 <div id="container">
 <div class="square"></div>
 <div class="square2"></div>
</div>
Paulie_D
  • 107,962
  • 13
  • 142
  • 161
Mo Hemati
  • 251
  • 1
  • 11

0 Answers0