我的问题看起来类似于我在这里找到的问题:
chrome vs FF/IE/Opera 计算表格单元格宽度?(表格布局:固定)
我简化了页面。该页面包含一个表格,在所有浏览器中看起来都相同,但 Chrome 除外。我相信问题是填充(不知道如何解决)或 doctype(我对 doctype 不太了解)...请帮助我使 Chrome 视图与任何其他浏览器中的视图相同。谢谢你。下面是我的html页面:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head>
<title>Looks different in Chrome vs FF, IE, Opera</title>
<style>
table.maintable {
background-color:yellow;
border: 1px solid red;
border-spacing:0;
border-collapse:collapse;
table-layout:fixed;
word-wrap:break-word;
}
table.maintable th, table.maintable td {
border: 1px solid red;
margin:0;
padding:14px;
}
</style>
</head>
<body>
I want the date look like 05/10/2011, in 1 string. Chrome cuts the date into 2 parts. All other browsers are OK. The problem is style <u>padding:14px;</u>, but we need some padding in cells. <br>
Also <b>table-layout:fixed;</b> and <b>word-wrap:break-word;</b> are needed because any long text without any spaces will not destroy the table size in this case. How to make Chrome look like any other browser?
<table class="maintable" style="width:510px;"><tbody>
<tr><th style="width:57px;">number number</th><th style="width:75px;">date</th><th>current info</th><th style="width:90px;">more</th></tr>
<tr><td><a href="http://google.com">40</a></td>
<td>05/10/2011</td>
<td><a href="http://google.com">2 lines in Crhome but 3 lines in other browsers. Also check the date.</a></td>
<td><a href="http://google.com">more...</a></td>
</tr>
</tbody>
</table>
</body></html>
如果您认为我的第一个字符串(doctype 声明)是错误的,请给我一个正确的。以西里尔语之一编写的网站。没有使用 xml。谢谢你。