@Robertb4 i had a similar issue with my calculator. But i had the opposite issue. every time i removed text from a div and it was empty it would add a bottom margin to the div. so i ended up placing the html entity code
which represents a space. kind of like a placeholder and it would go back to normal.
:warning: mr-kumar-abhishek already gave tylermoeller points