Center align 3 block divs


/ Published in: CSS
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <style type="text/css">
  2. div {
  3. display:inline;
  4. }
  5. div span {
  6. display:inline-block; height:100px; width:200px;
  7. background: #CCCCCC;
  8. }
  9. .container {
  10. display:block; width:800px; text-align:center; margin:0 auto; background:#FFFFFF;
  11. }
  12. </style>
  13. </head>
  14.  
  15. <body>
  16. <div class="container">
  17. <div class="left"><span>asdfasdfasdfsad asfsad</span></div>
  18. <div class="middle"><span>asdfasdfasdfsad asfsad</span></div>
  19. <div class="right"><span>asdfasdfasdfsad asfsad</span></div>
  20. </div>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.