我試圖擺脫<center
標籤在我的HTML,但顯然它並不是那麼容易在某些情況下。擺脫<center>標籤
這個回答:HTML: Replacement for <center> 也沒有爲我工作。
下面的示例應該集中Foo
和Bar
,但它不以Bar
爲中心。這裏有什麼問題?
<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Title</title>
</head>
<body>
<div style=" margin: 0 auto; text-align:center;">
Foo
<table>
<tr>
<td>Bar</td>
</tr>
</table>
</div>
</body>
</html>
如果我更換<div>
與<center>
然後一切正常indended,但<center>
標籤已經過時......
表是否有一個固定的寬度? –