Posted By

Jazzerus on 03/17/08


Tagged

internet explorer vertical-align


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

SpinZ
visuallyspun
vince2doom
RM
rockitdev


Vertical-Align for Stubborn Browsers


 / Published in: CSS
 

The statements beginning with a pound (#) are only read by Internet Explorer. All other lines ignore these statements. For some layouts you may need to set the container's position to absolute for all browsers -- simply remove the pound and change the value appropriately. If you want to horizontally align the inner div add text-align:center to either the container or the hackouter blocks.

  1. #container{
  2. display: table;
  3. #position: relative;
  4. overflow: hidden;
  5. }
  6. #hackouter {
  7. #position: absolute;
  8. #top: 50%;
  9. display: table-cell;
  10. vertical-align: middle;
  11. }
  12. #hackinner {
  13. #position: relative;
  14. #top: -50%;
  15. }

Report this snippet  

You need to login to post a comment.