CSS: Removing the space at the bottom of relatively positioned elements

The relatively positioned element like this adds a space at the bottom of the element:

#bottom {
  z-index: -1;
  position: relative;
  top: -100px;
}

The above CSS adds a 100px empty space below the #bottom element.
The easy way to get rid of that empty space is to replace top with margin-top, like this:

#bottom {
  z-index: -1;
  position: relative;
  margin-top: -100px; 
}

Comments

Popular posts from this blog

How to resolve 'res://ieframe.dll/acr_error.htm#' error (Internet Explorer stopped working while viewing a website)

htaccess: Redirecting multiple domains to the main domain

Removing index.php in Codeigniter using XAMPP on Windows