日期:2014-05-17  浏览次数:20577 次

关于div填充整个浏览器的问题
想实现div填充整个浏览器并可以看到div的border边框

html代码: 
HTML code
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
    html{ border:0; height:100%; }
    body{ margin:0px; padding:0px; height:100%; text-align:center; }
    .dvmain{ height:100%; border:solid 3px #33CC66; text-align:center; font-size:12px; }
</style>
</head>

<body>
    <div class="dvmain">
        <div></div>
    </div>
</body>
</html>

  运行结果:div最下端的border样式没有了。
  去掉overflow:hidden,div最下端的border样式有了但是浏览器出现了滚动条

  求Html+css高手给看看
 

------解决方案--------------------
HTML code

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
    html{ border:0; height:100%; }
    body{ margin:0px; padding:0px; height:100%; text-align:center; }
    .dvmain{ border:solid 3px #33CC66; margin-top:-6px; text-align:center; font-size:12px; height:100%;}
    .dvmain div{ background:#33CC66; height:6px;}
</style>
</head>
<body>
    <div class="dvmain"><div></div></div>
</body>
</html>