如何将表格与页面中间对齐
问题描述:
我知道这是一个简单的问题,但我如何调整< table>标记到页面的中心,使用css?
感谢
i know its a simple question, but how would i align a <table> tag to the center of the page, using css?
thanks
答
< table style =" width: 80%; align:center;">
<table style="width: 80%; align: center;">
或者您可以将整个表格包含在< div align =" center">< table ...>
< / table>< / div>
也是一个可行的解决方案,这可能在各种浏览器中效果更好,因为有些可能会或可能不会识别表格标签中的样式。
~nicholas
Or you could enclose the entire table in a <div align="center"><table ...>
</table></div>
is also a viable solution, this may work better in various browsers as some may or may not recognize the style in the table tag.
~nicholas
以及垂直对齐怎么样? (对于任何scrren分辨率,我希望表格在页面中心居中)
and what about vertical alignment? (for any scrren resolution I want a table to be centered in the center of the page)