Jump to content

Archived

This topic is now archived and is closed to further replies.

tjhilder

positioning and float problem

Recommended Posts

Hi,

I'm having some trouble with css positioning, basicly I have bunch of div tags, some inside each other, I go to center them (and also float) but by doing that, my main div (the one that the others are all in) will only include the ones that don't have float : left; in them, and plus on IE it's now not centering (FF is fine with it).

the link is below:
http://www.tjhilder.co.uk/new/test.php

(just click view source to see both the html and css.

if you can help me out, thanks a lot.

TJ

Share this post


Link to post
Share on other sites
If you want IE to center you div by using the margins, you need to include the document declartion

[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
[/code]

If you floating HTML elements, you'll need to clear them before closing the holding div

So, something like this in the style
[code]
.clear_float {clear:both;
height:1px;
overflow:hidden;
[/code]

and you middel section will look like this
[code]
<div id="middle">

middle
<div id="middle-top">
middle top
</div>
<div id="left">
left
</div>
<div id="right">
right
</div>
<div class="clear_float">&nbsp;</div>
</div>

[/code]

Share this post


Link to post
Share on other sites

×

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.