Floated DIV being pushed down in Firefox

This is a discussion on "Floated DIV being pushed down in Firefox" within the Web Page Design section. This forum, and the thread "Floated DIV being pushed down in Firefox are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 20th, 2007, 10:26
T34 T34 is offline
New Member
Join Date: Jul 2007
Location: UK
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Floated DIV being pushed down in Firefox

Hello all,

I've got an issue with layout in Firefox. I'm trying to create a two-column liquid layout consisting of a number of thumbnails on the left and a separate bit of content on the right.

I have used float to position the divs left and right. The problem is that in Firefox the left-hand div (the second one to make an appearance in the markup) is pushed beneath the right hand one in virtually all browser widths. If I put the left hand div first in the markup then the right hand one is pushed down.

Annoyingly, IE seems to get what I'm trying to do! Anyway, here is the code:

HTML:

Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<link href="default.css" rel="stylesheet" type="text/css">
</head>
<body>

<div id="right">
    Some text to appear on the right<br>
    <img src="design1_thumb.jpg"><br>
    <img src="design1_thumb.jpg"><br>
    <img src="design1_thumb.jpg"><br>
</div>

<div id="container">
    <img src="design1_thumb.jpg">
    <img src="design1_thumb.jpg">
    <img src="design1_thumb.jpg">
    <img src="design1_thumb.jpg">
    <img src="design1_thumb.jpg">
    <img src="design1_thumb.jpg">
    <img src="design1_thumb.jpg">
    <img src="design1_thumb.jpg">
    <img src="design1_thumb.jpg">
</div>

<div class="spacer">
</div>

Some more text

</body>
</html>
CSS:

Code: Select all
div.spacer {
    clear: both;
}
#right {
    float: right;
}
#container {
    background-color: #FF3300;
    float:left;
}
And the code in action (vary the width of your browser window in Firefox to see what I mean!):

http://www.theprideofthenorth.com/test3.php

Thanks in advance for any help/advice!
Reply With Quote

  #2 (permalink)  
Old Jul 20th, 2007, 10:53
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 21
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Floated DIV being pushed down in Firefox

Try setting widths on both elements using percentages. Use 15% and 85%. Providing there aren't any margins, paddings or borders then they should float along side each other.

See if it works.

Pete.
Reply With Quote
  #3 (permalink)  
Old Jul 20th, 2007, 11:06
T34 T34 is offline
New Member
Join Date: Jul 2007
Location: UK
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Floated DIV being pushed down in Firefox

Thanks for that, Pete, but that won't really do the trick as the right column needs to be fixed width (300px) with the rest of the content expanding to fill the available area.

Anything else that you could suggest?

Cheers,
John
Reply With Quote
  #4 (permalink)  
Old Jul 20th, 2007, 11:50
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Floated DIV being pushed down in Firefox

Get a better DOCTYPE ... HTML Strict would be perfect.

Try following this layout - http://bonrouge.com/2c-hf-fluid(r).php
Reply With Quote
  #5 (permalink)  
Old Jul 20th, 2007, 11:57
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Floated DIV being pushed down in Firefox

You need to add widths to everything. All image thumbnails need widths, both div's need widths. You need to add everything up so that you can fit the two side by side.
Right now all your thumbnails are going to line up side by side by side for eternity... therefore the right div is going to fall below. So by setting a width on the container div you are stopping the inlining from going on and on forever.
Reply With Quote
Reply

Tags
div, firefox, float, layout, positioning

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox vs. IE tox0tes Web Page Design 5 Jun 28th, 2007 17:24
ie7 bug - floated div with height 100% causes content to disappear trandrus Web Page Design 5 Jun 19th, 2007 22:13
Floated Divs dont expand centered div in firefox mikka23 Web Page Design 7 Jan 1st, 2007 01:17
extending background block beyond floated image snappy Web Page Design 18 Oct 27th, 2006 21:26
vertical-align problems with inline elem. and floated elem. gogogadgetearl Web Page Design 2 Jun 3rd, 2005 18:55


All times are GMT. The time now is 21:50.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43