Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/13336-positioning-and-float-problem/
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]
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.