Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What constitutes an elaborate hack? You can do it with a hack, but it isn't really elaborate. Put the div in an outer div. The outer div has `display: table-cell` and `vertical-align: middle`.


That's all good and fine unless you also have some requirements about the geometry and behavior of outer div. Then you need to add another div and give it display: table but that interferes with the structure of your document.

Also you might want outer div to fit the space it lies in and height: 100% does not always work.

Basically somewhere around transition from IE to Firefox and from transitional to strict DOCTYPE tables were broken beyond repair for layout purposes. We have not recovered since. Flexbox brings some hope but not necessarily salvation.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: