关于style="display:block"的问题

anyoneking 2008-07-07 06:21:08
我的一页html页面中的table加入了 style='display:block' .造成了table显示的问题.
页面代码如下:
<html>
<head>
</head>
<body>
<table id="testTable" width="100%" style="display:block;" border="1">
<tr>
<th height="50px">cccd</th>
<th height="50px" >aaa</th>
<th height="50px">eee</th>
<th height="50px" >ddd</th>
<th height="50px">ccc</th>
<th>bbb</th>
</tr>
<tr>
<td>gggggg</td>
<td>eeeeee</td>
<td>dddddd</td>
<td>ccccc</td>
<td>bbbbb</td>
<td>asdasdsadas</td>
</tr>
</table>
</body>
</html>
去掉style="display:block;"和加上style="display:block;",在table显示中有很大的差别.请问下,这是什么原因?
...全文
610 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
asdfgh_5982 2008-07-08
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 anyoneking 的回复:]
@cuidenghong123. 能否解释下display:block,这个属性在css中的作用,为什么会造成这个结果?
[/Quote]

你把<th height="50px">cccd </th>
<th height="50px" >aaa </th>
<th height="50px">eee </th>
<th height="50px" >ddd </th>
<th height="50px">ccc </th>
每个个占宽度的百分比定死,就不会出现这种情况了
FF里面会根据<th>的长度自适应宽度,所以会出现右边有很大空白的问题
这个问题上FF比较规范,这个结果不是block造成的而是浏览器不同造成的
chenyu112 2008-07-08
  • 打赏
  • 举报
回复
anyoneking 2008-07-08
  • 打赏
  • 举报
回复
@cuidenghong123. 能否解释下display:block,这个属性在css中的作用,为什么会造成这个结果?
cuidenghong123 2008-07-07
  • 打赏
  • 举报
回复
在firefox下则需要使用display=none/table-cell来进行控制
sjmlsxp 2008-07-07
  • 打赏
  • 举报
回复
IE是6还是7啊?
anyoneking 2008-07-07
  • 打赏
  • 举报
回复
我是楼主,顺便说一下,在ie下是正常的,在firefox下才会出现问题!希望牛人能给予解答!谢谢!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧