Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Container of floats not rendered the same 2

Status
Not open for further replies.

OsakaWebbie

Programmer
Feb 11, 2003
628
JP
I'm having fits trying to find the cause of a difference between different browsers' reaction to my CSS. The site is (if you don't want to look at too much Japanese, try The CSS file is I currently have a silly red border on the div that is showing differently, which is id=header. I also have a silly cyan border on the <ul> which has no height of its own (so the cyan is just a line). I will only leave the borders there for a day or two (or until I solve this, whichever comes first), as the site is in use.

IE, Firefox, and Opera all assign no height to the <ul> even though there are <li> items in it, presumably because the <li>'s are float:left. But although IE and Opera place the bottom of the header div at the bottom of the <li>'s, Firefox puts it at the the bottom of the <ul> itself (ignoring the size of the floating items). I got the basics of the li-becomes-horizontal-menu trick from another web site, so I don't fully understand why it works the way it does, but without float:left they just line up below each other. Any ideas on how I can get the code to be rendered the same by these top browsers, or even just IE and Firefox?
 
Could you just give the <ul> a height value?
Code:
nav ul {
height:20px;
//other bits here
.
.
}

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Thanks, Chris! That worked like a charm. John, your idea probably would have worked also, but I prefer not to predetermine the height because I don't know how tall a given user's font will be. Chris's is more of a correction rather than a workaround.

Tek-tips is great!
 
Wow, even cleaner - thanks! Interestingly, when I implemented your solution and put the colored borders back in to see what's what, it revealed that with "overflow:auto", Firefox and Opera now consider the size of the <ul> to encompass the <li>'s, but IE still shows the <ul> with no actual height. But it still starts the next div below the <li>'s, so the result is the same. I still have a lot to learn about CSS, especially regarding floats, but you guys are a great help!
 
Actually, at least in IE6.0 it looks like it works fine even without the hack (I don't care how tall it thinks the <ul> is as long as it spaces visible things correctly). But if you don't mind my asking, what in the world does setting the height to 1% do? More CSS voodoo... [wink]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top