在IE6、ff下显示正常,在IE7下(每次刷新都看不到滚动条)需要点击链接才能把垂直方向的滚动条激活显示出来,很怪,不知道是不是bug。
在去掉顶部的DTD定义、给table定义小一些的百分比都能解决问题,如果table内没有链接则无法显示出滚动条,很怪,有了解这个问题的朋友欢迎交流。源码如下:
[codes=html]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>table test</title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<style>
.scrolltest {
width:80%;
height: 60px;
background:#red;
overflow-y: auto;
overflow-x: hidden;
}
</style>
</head>
<body >
<div class="scrolltest">
<table width=100%>
<tr>
<td><a href="#">scrolltest</a></td>
<td>scrolltest</td>
</tr>
<tr>
<td>scrolltest</td>
<td>scrolltest</td>
</tr>
<tr>
<td>scrolltest</td>
<td>scrolltest</td>
</tr>
</table>
</div>
</body>
</html>[/codes]
在去掉顶部的DTD定义、给table定义小一些的百分比都能解决问题,如果table内没有链接则无法显示出滚动条,很怪,有了解这个问题的朋友欢迎交流。源码如下:
[codes=html]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>table test</title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<style>
.scrolltest {
width:80%;
height: 60px;
background:#red;
overflow-y: auto;
overflow-x: hidden;
}
</style>
</head>
<body >
<div class="scrolltest">
<table width=100%>
<tr>
<td><a href="#">scrolltest</a></td>
<td>scrolltest</td>
</tr>
<tr>
<td>scrolltest</td>
<td>scrolltest</td>
</tr>
<tr>
<td>scrolltest</td>
<td>scrolltest</td>
</tr>
</table>
</div>
</body>
</html>[/codes]

可以
