Jump to content

Recommended Posts

Posted (edited)

Hey

Im having some problems with Div ID containers.

 

http://www.ictkix.com/dlewis/externalsites/index.html

 

If you look at that in opera or safari the container works and it is displayed in the middle. But in IE and Mozilla the container clearly doesnt work.

 

This is the section of CSS that contains it:

 

#first_container
{
 margin: 0 auto 0 auto; 
 display: table; 
 height: 100%;  
 position: relative; 
 overflow: hidden; 
 width: 660px;
}

 

And the HTML:

 

 

Any help is much appreciated

Regards

Duncan :)

CONTENT

CONTENT
id="first_container">
Edited by dunc453
Posted

It's centered in Firefox. But where is your (HTML 4.01 strict) doctype? And tables are for tabular data, not layout.

 

Add the doctype, then make sure everything validates.

Posted

This code should center the div when you have a doctype because it has a width and side margins auto:-

#first_container

{

margin: 0 auto 0 auto;

display: table;

height: 100%;

position: relative;

overflow: hidden;

width: 660px;

}

 

This code align="center" is old-fashioned; you should use an id or class with a width and side margins auto:-

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...