Jump to content
Sign in to follow this  
SWG

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>

Share this post


Link to post
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>

or

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

Share this post


Link to post
Share on other sites

Thanks for the help guys.Setting the margin to 0px helped.Thanks for the tips in regards to DIV and SPAN, I'll have to read up on both since I'm not that experienced with either (could you tell? ;-)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...