473,396 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Unexpected space in div in firefox

5
Hi
I am using a menu adapted from cssplay.co.uk, which is fine, but I want to add a coloured border around it, so I am nesting a div with a border. This works fine in Opera & IE6 (havnt tested IE7 yet as my XP box went up in smoke this week!) but in Firefox 2.0.0.9 there is a space at the bottom and I just cant see why ... I have setup a test page with 2 example menus Click here for example ..any ideas what could be causing this prob ?
Many Thanks
Chris

Code snip
Expand|Select|Wrap|Line Numbers
  1.  
  2. <div id="menu-main">
  3. <div id="menu-main-border">
  4. <ul>
  5. <li id="current"><a href="index.html"><span>Home</span></a></li>
  6. <li><a href="products.html"><span>Products</span></a></li>
  7. <li><a href="services.html"><span>Services</span></a></li>
  8. <li><a href="contact.html"><span>Contact</span></a></li>
  9. </ul>
  10. </div>
  11. </div>
  12.  
CSS Snip
#menu-main {
position: relative;

font-size:13px;
line-height:normal;

margin:0px;
padding:0px;
}

#menu-main-border {
position: absolute;

border-color: #8CAAE7;
border-width: 7px;
border-style: solid;

margin:0px;
padding:0px;
}

#menu-main ul {
/*height:20px; */
margin:0px;
padding:0px;

list-style: none;
}
#menu-main li {
display:inline;
margin:0px;
padding:0px;
}
#menu-main a {
float:left;
background:url("ddmenu/tableft.gif") no-repeat left top;
margin:0px;
padding: 0px 0px 0px 10px;
text-decoration:none;
}
#menu-main a span {
float:left;
display:block;
background:url("ddmenu/tabright.gif") no-repeat right top;
padding:5px 15px 4px 6px;
color:#666;
}
/* Commented Backslash Hack hides rule from IE5-Mac \*/
#menu-main a span {float:none;}
/* End IE5-Mac hack */
#menu-main a:hover span {
color:#fff;
}
#menu-main a:hover {
background-position:0% -42px;
}
#menu-main a:hover span {
background-position:100% -42px;
}
#menu-main #current a {
background-position:0% -42px;
}
#menu-main #current a span {
background-position:100% -42px;
}
Nov 2 '07 #1
8 2085
drhowarddrfine
7,435 Expert 4TB
And id is a unique name given to only one element per page but you use the same name several times. Fix this first.
Nov 2 '07 #2
ChrisZ
5
Hi
First, a correction, this code is actually adapted from CSS tab designer from highdots.com.

Sorry, The error was cause because I pasted up the code quickly to create the test page ... I have removed the second menu so page html & css now validates.

Thanks for looking...
Chris
Nov 4 '07 #3
ChrisZ
5
A little more info...
I have tested the page on browsershots.org and the error only happens on firefox (1.5 & 2) ...

displays fine on IE (6&7), Opera (9.23&9.24), Konqueror 3.5 and Safari (2mac&3win)
Nov 4 '07 #4
drhowarddrfine
7,435 Expert 4TB
I'm running out the door. It looks like your images are seperate from your text. Perhaps the absolute positioning is causing the background to come up because of that. You should make the background part of the text background. Sorry, on the run.
Nov 4 '07 #5
ChrisZ
5
It looks like your images are seperate from your text. Perhaps the absolute positioning is causing the background to come up because of that. You should make the background part of the text background. Sorry, on the run.
I added the #menu-main-border with absolute positioning to make it snap to the size of the contents inside, without it #menu-main-border reverts to the width of its parent and the height is unafected by the child elements within. The parent must be relative so that it can be positioned correctly to the other elements on the page.

The background is in 2 parts so it can "stretch" to the text contents and is applied to the texts container element (the span) and the surrounding anchor and appear to be displaying at the correct size and position ... just with white space under them in FF ... most frustrating!

No worries .... any thoughts appreciated.

Chris
Nov 4 '07 #6
drhowarddrfine
7,435 Expert 4TB
It is the absolute positioning. AP causes the element to be removed from the normal flow. This is why the text moves up, and thus the bottom also moves up, to take the space vacated by the border div. Why the other browsers are doing what they are, I don't know, but this is another "drive by viewing" on my part. :)
Nov 4 '07 #7
drhowarddrfine
7,435 Expert 4TB
This is so weird. I was going to admonish you for making your html and css more complicated than necessary. I whipped out this css:
Expand|Select|Wrap|Line Numbers
  1. /*
  2. Top level menu
  3. */
  4. *{margin:0;padding:0}
  5.  
  6.     #menu-main {
  7.     border:7px solid blue;
  8.     overflow:auto;
  9.     position: absolute; 
  10.       font-size:13px;
  11.      }
  12.  
  13.     #menu-main ul {        
  14.       list-style: none;
  15.       }
  16.  
  17.     #menu-main a {
  18.       float:left;
  19.       background:url("tableft.gif") no-repeat left top;
  20.       text-decoration:none;
  21.       }
  22.     #menu-main a span {
  23.       background:url("tabright.gif") no-repeat right top;
  24.       padding:5px 15px 4px 6px;
  25.       color:#666;
  26.       }
  27.  
  28.     #menu-main a:hover span {
  29.       color:#fff;
  30.       }
  31.     #menu-main a:hover {
  32.       background-position:0% -42px;
  33.       }
  34.     #menu-main a:hover span {
  35.       background-position:100% -42px;
  36.       }
  37.     #menu-main #current a {
  38.             background-position:0% -42px;
  39.     }
  40.     #menu-main #current a span {
  41.             background-position:100% -42px;
  42.     }
  43.  
which works great in Firefox but IE and Opera ignore it. I have to be missing something but I'm running around too much to think.
Nov 4 '07 #8
ChrisZ
5
I had to put alot of the code you removed back in to get the buttons to display correctly (the code is not ott but designed to be added to other css files) and while doing so I realised that I needed to control the overflow in the original version by adding the overflow:hidden; to #menu-main-border (overflow:auto gives a scroll bar in opera)

This allows me to have the menu relative to other code (better to use in different layouts)

Now tested in IE6, Opera 924 & FF 2009 ... will check others now

thanks for the assist,
Chris
Nov 4 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: skeeterbug | last post by:
http://www.geocities.com/operationsengineer1/test2.htm the extra space between the logoHeader and the menu bar occurs when i add the <ul>. if i comment out the ul and and all the li, the 1em...
6
by: yawnmoth | last post by:
I'm having some problems with the CSS on the following page: http://www.frostjedi.com/terra/scripts/graemlin2.html First, in Firefox, there's unwanted space between the #header div and the...
7
by: yawnmoth | last post by:
i have an image inside a table, and am getting an unexpected space underneath the image in firefox and opera (but not in IE). i've tried setting margin padding and border to 0 to no avail. here's...
8
by: lkrubner | last post by:
Am I wrong, or do paragraphs have extra space on top in FireFox, when compared to Microsoft IE. The top of this page is an example: http://www.publicdomainsoftware.org/index.php?pageId=299 The...
5
by: Michael Shell | last post by:
Greetings, Consider the XHTML document attached at the end of this post. When viewed under Firefox 1.0.5 on Linux, highlighting and pasting (into a text editor) the <pre> tag listing will...
20
by: Dr John Stockton | last post by:
In <URL:http://www.merlyn.demon.co.uk/estrdate.htm#T3> the button "Table III Reversed" executes function BCPTableIII() { var GN, DM, Ro, CY document.write("\t\t\tCalculated Table III",...
3
by: UnixSlaxer | last post by:
Hello All, While doing some TPC benchmark testing on DB2-UDB 8.2, I face the following problem when running this query: select * from lineitem where l_shipdate <= date '1998-12-01' -...
2
by: P | last post by:
Hi all, I'm trying to run the following code taken from http://blogs.ittoolbox.com/database/technology/archives/006045.asp# select substr(tablespace_name,1,30) as "Tablespace Name", case...
5
by: Richard Maher | last post by:
Hi, Can someone please show me how to tell Firefox to preseve white-space when returning the selectList.option.value attribute? I have change the style so that the white-space is preserved on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.