Old 23-08-2004, 06:05   #1 (permalink)
sleepingfish
css is for divs
 
sleepingfish's Avatar
 
Join Date: Feb 2003
Location: Norwich
Posts: 4,527
DIV height Mozilla/FF

Can't remember this one, it's Monday morning, was wondering if any clever people could help me out.

Containing DIV has no set height so should be the height of the content within it. Works fine in IE but has no height in Mozilla. Sure I've sorted this before but can't get my head in gear this morning.

TIA
  Reply With Quote
Old 23-08-2004, 06:25   #2 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,215
add a clearing div beneath it and hide it?

<div id="clearer"><hr /></div>

#clearer {display: none;}

or something like that?
  Reply With Quote
Old 23-08-2004, 06:27   #3 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,215
ps - i've seen some with <div id="clearer">&nbsp;</div> but i feel this is wrong - an <hr /> can show so much more to those that see it.
  Reply With Quote
Old 23-08-2004, 06:34   #4 (permalink)
sleepingfish
css is for divs
 
sleepingfish's Avatar
 
Join Date: Feb 2003
Location: Norwich
Posts: 4,527
Cheers, the thing is the height really needs to change from page to page, depending on the content.
  Reply With Quote
Old 23-08-2004, 06:44   #5 (permalink)
Jay-NL
Not A Designer
 
Jay-NL's Avatar
 
Join Date: Jul 2004
Location: tHe NeTHerLaNDs
Posts: 122
This works, although it has 1px extra height in FF.

<div style="clear: both"></div>

No need for content. I think setting display to none would work but IMHO it's wrong. Display: none would remove the div from the flow entirely - so I don't think it should clear then.
__________________
-= In theory, theory should work in practice. =-
  Reply With Quote
Old 23-08-2004, 06:46   #6 (permalink)
sleepingfish
css is for divs
 
sleepingfish's Avatar
 
Join Date: Feb 2003
Location: Norwich
Posts: 4,527
In FF the containing DIV doesn't seem to be containing anything, it's appearing above the DIVs that are within it.
  Reply With Quote
Old 23-08-2004, 06:47   #7 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,215
ok, confusion now set in. can we see it?
  Reply With Quote
Old 23-08-2004, 07:09   #8 (permalink)
sleepingfish
css is for divs
 
sleepingfish's Avatar
 
Join Date: Feb 2003
Location: Norwich
Posts: 4,527
Ha ha, yes I'm good at confusion. Ok then here's a stripped-down version with the same issue.

In IE the dark blue box has everythign inside it, this is what is supposed to happen. In FF however, the containing DIV just sits at the top as if nothing is inside it.

(the css is here)
  Reply With Quote
Old 23-08-2004, 07:27   #9 (permalink)
Jay-NL
Not A Designer
 
Jay-NL's Avatar
 
Join Date: Jul 2004
Location: tHe NeTHerLaNDs
Posts: 122
Use the footer to clear (in the footer, set clear: both). If you don't want a footer, create an empty div at the same place like so: <div style="clear:both"></div>

However, if you're planning to do columns, you may want to look at faux columns at alistapart. A lot easier. [edit] maybe not so much easier, but more flexible and fun - you can create really nice effects with it [/edit]
__________________
-= In theory, theory should work in practice. =-
  Reply With Quote
Old 23-08-2004, 07:39   #10 (permalink)
sleepingfish
css is for divs
 
sleepingfish's Avatar
 
Join Date: Feb 2003
Location: Norwich
Posts: 4,527
I just added
Code:
clear: both;
to #footer but it doesn't seem to be doing the trick.
  Reply With Quote
Old 23-08-2004, 07:54   #11 (permalink)
Jay-NL
Not A Designer
 
Jay-NL's Avatar
 
Join Date: Jul 2004
Location: tHe NeTHerLaNDs
Posts: 122
Because it's floating. No need for that.
__________________
-= In theory, theory should work in practice. =-
  Reply With Quote
Old 23-08-2004, 07:55   #12 (permalink)
stickmus
hmmm...
 
stickmus's Avatar
 
Join Date: Jan 2004
Location: Yorkuk
Posts: 2,130
You need to remove the float:left from the footer too.
  Reply With Quote
Old 23-08-2004, 07:55   #13 (permalink)
sleepingfish
css is for divs
 
sleepingfish's Avatar
 
Join Date: Feb 2003
Location: Norwich
Posts: 4,527
I added
Code:
overflow: hidden
to the container DIV and it works!

Cheers all, I fecking hate Mondays.
  Reply With Quote
Old 23-08-2004, 07:59   #14 (permalink)
sleepingfish
css is for divs
 
sleepingfish's Avatar
 
Join Date: Feb 2003
Location: Norwich
Posts: 4,527
Ahah, by the time I'd posted that last reply there were the posts about the float:left - removed that (and taken out the unecessary overflow: hidden; from the container DIV) and it does indeed work. Thanks again.
  Reply With Quote
Old 23-08-2004, 07:59   #15 (permalink)
stickmus
hmmm...
 
stickmus's Avatar
 
Join Date: Jan 2004
Location: Yorkuk
Posts: 2,130
Take off the float and the width for the rightcolumn too.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8