Jump to content

Center main container


williamrouse

Recommended Posts

I also noticed that "min-height" is not supported in IE8. Is there a work around for that.

Min-height is supported in IE8 -- it has worked just fine for me on a variety of projects. Are you sure you don't mean IE6? I know it doesn't work in IE6.

 

In the case of IE6, you can fix it with a star hack (like below) or by providing an IE6 specific stylesheet using conditional comments.

 

For modern browsers:

#content { min-height: 500px; }

 

For IE6:

* html #content { height: 500px; }

Link to comment
Share on other sites

The link seems to be broken, but I found this example:
The link works just fine - just tried it.

 

And your code - which is what I used EXACTLY works, too, and centers your main container.

 

Nothing wrong with the code from the flumpcakes link you posted - but note how it mentions how it functions in IE4? It also worked for IE5 and, unless you want to really still support those, the code you first posted is the way to go. For those old browsers, you had to add the 'text-align: center' to your body tag. That would center EVERYTHING - so you needed to add the 'text-align: left' to your next division, to get everything back to normal. With IE6 and newer (all the way up to IE8.XXXXXXX), that is no longer necessary, and just giving your main division a width and adding the right and left margins of auto does the trick.

 

Re your min-width issue (or any other issue for that matter) it would be best if you could post a link to your site so we can see what you really have out there.

Link to comment
Share on other sites

Andrea: I'll have to make some demo area on my home page for you to see it...
I assume you have a hosting account? Just upload a testing page there - or create a folder for this purpose

 

But now that you've found the cause of the problem, you can just delete it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...