html - center three divs side by side -


i have 3 divs want center side side on page. have content such <p> , <h3> tags in them

html (example)

<div id = "wrapper">      <div class = "aboutleft">          <h1> </h1>         <h3> small description </h3>         <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. donec tristique non odio nec              few sentences go here          </p>     </div>      <div class = "vline"></div>      <div class = "aboutright">         <h1> shop/clients </h1>         <h3> small description </h3>         <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. donec tristique non odio ne             few sentences go here          </p>     </div> </div> 

css

.aboutleft {     display:inline-block;     float:left;     width: 450px;        }  #wrapper {     text-align:center;     width: 80%;     margin: 0, auto;     } .aboutright {     display: inline-block;     float:right;     width: 450px; }  .vline {     background: rgb(186,177,152);     display: inline-block;     float: left;     min-height: 250px;     margin: 0 30px;     width: 1px; } 

the result of 3 divs floating left. want center 3 of them on page.

try without float , text-align:center; on #wrapper. since blocks display:inline-block;, they'll center same way text does.

note nto make responsive, swapped widths % instead of px , removed margin spacing. i've added vertical-align:top; divs aline along top.

#wrapper{     text-align:center;     width: 80%;     margin: 0 auto;     text-align: center; } .aboutleft, .aboutright{     display: inline-block;     vertical-align:top;     width: 48%; } .vline{     background: rgb(186,177,152);     display: inline-block;     vertical-align:top;     min-height: 250px;     margin: 0;     width: 1px; } 

http://jsfiddle.net/dacrosby/ce3uz/2/


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -