html - How To Have Multiple Divs On One Line With Even Spacing -


trying multiple divs on same line spacing. nicely fit whole container.

here have got far. tried set margin right , left equal same on boxes, still tricky make , final box go on new line.

html

     <div id="servicebox">      <div class="servicebox1">         <h2> heading 1</h2>         <p>information</p>     </div>      <div class="servicebox2">         <h2>heading 2</h2>         <p> information</p>     </div>     <div class="servicebox3">         <h2>heading 3</h2>         <p>information</p>      </div>     <div class="servicebox4">         <h2>heading 4</h2>         <p>information</p>      </div>  </div> 

css

#servicebox {     width:100%;     margin: 0 auto;     margin-top:75px;     height:250px;     border:1px solid black; } .servicebox1, .servicebox2, .servicebox3, .servicebox4 {     float:left;     width:20%;     height: 250px;     background-color: white;     border: 1px solid #bdbdbd;     -webkit-border-radius: 5px;     border-radius: 5px;     -moz-box-shadow: 0 0 10px #bdbdbd;     -webkit-box-shadow: 0 0 10px #bdbdbd;     box-shadow: 0 0 10px #bdbdbd; } 

http://jsfiddle.net/ruj2r/3/

i suggest adding new element inside each servicebox, in example div class box

css:

#servicebox {     width:100%;     margin: 0 auto;     margin-top:75px;     height:250px;     border:1px solid black; } .servicebox1, .servicebox2, .servicebox3, .servicebox4 {     float:left;     width:25%; }  .box{     height: 250px;     background-color: white;     border:1px solid #bdbdbd;     -webkit-border-radius: 5px;     border-radius: 5px;     -moz-box-shadow: 0 0 10px #bdbdbd;     -webkit-box-shadow: 0 0 10px #bdbdbd;     box-shadow: 0 0 10px #bdbdbd; } 

html

 <div id="servicebox">      <div class="servicebox1">         <div class="box">         <h2> heading 1</h2>         <p>information</p>         </div>     </div>      <div class="servicebox2">          <div class="box">         <h2>heading 2</h2>         <p> information</p>          </div>     </div>     <div class="servicebox3">         <div class="box">         <h2>heading 3</h2>         <p>information</p>         </div>      </div>     <div class="servicebox4">         <div class="box">         <h2>heading 4</h2>         <p>information</p>         </div>      </div>  </div> 

this way service boxes nicely quarter of container , inside service box can add border , shading new box element


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -