Jump to content

[SOLVED] Float left dosn't work in firefox


otuatail

Recommended Posts

your coding is a bit of a mess, is there a reason you did not use a span class to make your text red ?.. or did you not realise you dont need to make another div when all you have to use is

 

<span class="red">this would be red</span>

 

then put

 

span .red { color:red; }

in your css ?

 

that is just one example... I think your issue is that what you really needed was a left div and a right one to separate them, and use margin to align them where you want.. like a 2 column layout.

Link to comment
Share on other sites

I had this guy who said tables suck. Divs are ACE. I could do this in a table. But if I wanted to do this in divs. Say for exmple I want a cube. 3 divs in a row and 3 rows of 3 divs.

 

Cant say float:left , float:middle, float:right

 

This is the problem but if it can't work in IE6 then that is OK with me but IE7+ and all versions of FF Opera and Safari that are reasonably recent.

 

 

Link to comment
Share on other sites

to make a container with 3 columns

 

<div id="container">
<div id="left"></div>
<div id="middle"></div>
<div id="right"></div>
</div>

 

and the css might look something like this

 

#container { float: left; width:75px; height:100px;}
#left { float:left; width:25px; height:100px; }
#middle { float:left; width:25px; height:100px }
#right { float:right; width:25px; height:100px }

 

there are a couple of things you might notice...

 

I have set the height of each div to no more than the height of the container.

 

each div has 25px width, in total this is no more than the container ( in this case 75px ).

 

I have floated the middle one left, this is not always necessary but every now and then it can cause issues not to mention it, so I do anyway.

 

the containers closing div is the very last thing in the html, this is why its called a container, because its 'wrapping' the other divs, so we can position the container where we like and the other divs will follow.

 

if you wanted to add margin or padding to the divs inside the container, to move it, we have to reduce the size of the div or make the containing div larger to accommodate it, as margins and padding add length/height depending on where you have placed your margins or paddings

 

if we wanted to do another box exactly the same under it, we can change them from id's to classes, that way it wont be invalid and you can keep using the divs however often you like

 

follow these basic rules and you wont go far wrong,

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.