If you do not want to change the structure of HTML, add the following styles:
.collapse.in { display: inherit; visibility: visible; } .collapse { display: inherit; visibility: hidden; }
Bootstrap sets the display to none when the animation ends, which removes the entire div, including padding. Setting visibility to hidden does not remove the div, but the height is 0, so everything else is indented.
Ensure that these styles are defined after the loading stylesheet.
source share