Making floated element alignments to center

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lagon666
    New Member
    • Jun 2009
    • 22

    Making floated element alignments to center

    Is it possible to change #wrapper's inner elements alignments to center of page? I think its possible by using TABLE, but what about DIV?
    Code:
    <style>
    #left {
    	background: red;
    	width: 100px;
    	float: left;
    }
    
    #center {
    	background: green;
    	width: 200px;
    	float: left;
    }
    
    #right {
    	background: blue;
    	width: 100px;
    	float: left;
    }
    </style>
    <div id="wrapper">
    	<div id="left">LEFT</div>
    	<div id="center">CENTER</div>
    	<div id="right">RIGHT</div>
    </div>
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    If you assign a width to the wrapper div and give it margin:0 auto that will center it.

    Comment

    Working...