Centering a div of unknown width


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



Copy this code and paste it in your HTML
  1. .message-container {
  2. margin: 0 auto 8px;
  3. display: table;
  4. }
  5.  
  6. .message-container div {
  7. display: table-cell;
  8. }
  9.  
  10.  
  11. <!--[if IE]>
  12. .message-container {
  13. display: block;
  14. text-align: center;
  15. }
  16. .message-container div {
  17. display: inline;
  18. zoom: 1;
  19. }
  20. <![endif]-->

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.