Why position relative leaves empty space below the div?

When we want to move the div, we give position:relative to the div and moved div to top-bottom, left-right directions like-

div{
       position: relative;
       top: -127px;
       right: 50px;
  }
       
But, usually when we give position:relative to the div, the position:relative leaves empty space below the div. So, In this case, we can use a nagative margin-bottom in the relative element that you have moved like-

div{
       position: relative;
       top: -127px;
       right: 50px;
       margin-bottom: -127px;
  }
      

Comments

Popular posts from this blog

Why entrance animation not working in Elementor?

What is difference between GET and POST methods in php?