OK! I'm thick! What's the CSS positioning code for aligning a table on the center of a page, either horizontally, vertically or both?
OK! I'm thick! What's the CSS positioning code for aligning a table on the center of a page, either horizontally, vertically or both?
They haven't decided yet. Try:
table {
margin:0 auto;
}
* html table {
margin: 0 20%:
}
That's horizontal centering, I imagine vertical would be the opposite and both would be auto auto and 20% 20% respectively but, vertical centering is an odd concept and might not be supported.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
It was decided years ago. Blame browser manufactures for poor (or no) implementation.Originally Posted by jscheuer1
See http://css-discuss.incutio.com/?page...ngBlockElement. Note that vertical centring is a real pain in the ass because of poor CSS support, particularly from IE.
No, that wouldn't work without extra effort, but it's close:That's horizontal centering, I imagine vertical would be the opposite and both would be auto auto and 20% 20% respectively
If you added similar declarations for horizontal dimensions, you'd get horizontal centring, too. However, you can guess where this doesn't work.Code:<selector> { position: absolute; height: ...; margin: auto 0; top: 0; bottom: 0; }
Mike
Bookmarks