How to center a properly cleared DIV structure?

Dear Experts,

i am struggling with a page Layout. Basically, its structured like this:

* Main container
-- Content area
-- Sidebar

After realizing that my content will not stretch my DIV to its full height, i ended up on google and found the so-called clearfix method / hack.

I applied it. And yes, basically it does work, but it throws up a new problem.

Now my design is no longer centered. It is always stuck on the left.

Can anyone help me with this?

Thank you!
.clearfix:after {
	visibility: hidden;
	display: block;
	font-size: 0;
	content: " ";
	clear: both;
	height: 0;

* html .clearfix             { zoom: 1; } /* IE6 */
*:first-child+html .clearfix { zoom: 1; } /* IE7 */

.clearfix {
	display: inline-table;

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shinesh PremrajanEngineering ManagerCommented:
#container {
  width: 700px ;
  margin-left: auto ;
  margin-right: auto ;

hope this helps
spiritwithinAuthor Commented:
Thank you!

I was already using the automargin method but it is what doesnt work anymore, once i apply the clearfix.

My bad, i should have shown how my structure looks like:
html {
	 height:			100%;

body {   
     margin:            0px;
     padding:           0px;
	 font-weight:       normal; 
     font-family:       Georgia, Tahoma, Arial, Verdana, Geneva, sans-serif;
     font-size:         12px;
     color:             #000000;
	 height:			100%;
	 min-height:		100%;
	 background-color:	#150401;
	 background-repeat:	repeat-x;
	 background-image:	url('/img/page/bgGradient.jpg');

			.x-outer {
				position:			relative;
				width:				778px;
				margin:				0px auto;
				min-height:			100%;
				height:				auto !important;
				height:				100%;
				background-color:	#ffffff;
				background-image:	url('/img/missy/page/bgMidGradient.gif');

			.x-outer .x-container {
				float:				 left;
				height:				 100%;
				width:				 491px;
				padding-left:        16px;

			.x-outer .sidebar {
				background-color:	 #dddfc0;
				border-left:	 	 1px solid #fffbed;
				float:				 right;
				width:				 240px;
				padding-left:		 22px;

		<div class="x-outer">
			<div class="x-container">

Open in new window

spiritwithinAuthor Commented:
Oh, and - i have tried removing the

display: inline-table

from the clearfix already. Then its centered again, but the clearfix doesnt work properly, the way it should, anymore.
spiritwithinAuthor Commented:
I was able to fix the problem by using a height attribute only on the primary outer container, but not on the inner containers. I was then able to remove the inline-table property from the clearfix without losing clearfix functionality.

Topic closed.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.