【发布时间】:2023-03-30 02:40:01
【问题描述】:
查看http://www.eveo.org
方便修改的下载地址:
http://www.eveo.org/backup/eveo.rar
http://www.eveo.org/backup/eveo.zip
正如你现在所看到的,它使用简单的表格方法水平和垂直居中:
<table cellpadding="0" cellspacing="0">
<tr>
<td align="left">
*put anything in here and it will be aligned horizontally and vertically
</td>
</tr>
</table>
accompanying CSS:
table
{
height: 100%;
width: 100%;
vertical-align: middle;
}
但是,在我的文档中我没有设置文档类型,我只有:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
如果我添加如下标准文档类型:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
我的表格方法不再有效并且不起作用。因此,无论浏览器窗口大小如何,我都需要一种新的方式来使我的网页垂直和水平居中。
【问题讨论】: