How can I vertically align a table in the middle of the screen with css?
Generally something along the lines of this works pretty well in any block element with a defined height.
table {
position: absolute;
top: 50%;
margin-top: -50%;
}
Centering on the page is harder since you don't have a defined height, but I think this works.
html {
height: 100%;
}
You may encounter some browser differences, act accordingly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With