Jump to content

Annoying space between DIVs, how do I remove it?


Recommended Posts

Hi.I'm trying to make a menu using <DIV> and stylesheets and have a problem removing the space bewteen the DIVs. I've put a top border on the content DIV and a bottom border on the titlebar DIV (green and red) to encase the space I'm talking about. When viewing the page in IE there is only the single space, but when viewing it in Firefox there is an additional space above the titlebar DIV, I'd like to remove both if possible. If you have any suggestions, help or another way of doing it, I'd appreciate it. :)

<html><head><title>:: My startpage ::</title><style type="text/css"> body {  background-color:#000; } .menu {  position:absolute;  top:10;  left:10;  width:20%;  color:#000;  background-color:#EEF;  margin:1px;  border:1px solid #fff;  font-family:verdana; } .title_bar {  background:url(title_bar.gif) repeat-x;  border-bottom:10px solid #f00;  color:#333;  font-size:1.0em;  font-weight:bold;  font-variant:SMALL-CAPS;  padding:3px 3px 3px 3px; } .content {  background-color:#DDF;  border-top:10px solid #0f0;  padding:5px 5px 5px 5px; } .link {  font-size:.8em;  color:#333;  text-decoration:none; } a:hover {  color:#888; }</style></head><body><div class="menu"> <div>  <h2 class="title_bar">News</h2> </div> <div class="content">  <a class="link" href="http://www.bt.dk">BT.dk</a><br>  <a class="link" href="http://www.eb.dk">Ekstra Bladet</a> </div></div></body></html>

Link to comment
Share on other sites

Try setting the margins in the titlebar and content to 0px. Also, it seems pointless to have:

<div>  <h2 class="title_bar">    News  </h2></div>

when you could either just have

<h2 class="title_bar">  News</h2>


<div class="title_bar">  News</div>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...