当前位置:编程学习 > C#/ASP.NET >>

简单问题。。关于<table height="100%">

就是想把整个table占满整个页面。。原来的代码都可以。。但是用了vs2010之后就不可以了。。有大吓知道的指点一下。。  --------------------编程问答--------------------
引用 楼主 misng 的回复:
就是想把整个table占满整个页面。。原来的代码都可以。。但是用了vs2010之后就不可以了。。有大吓知道的指点一下。。 

F12 看下 --------------------编程问答--------------------
 <style type="text/css">
        body{ margin:0; padding:0;}
    </style>
--------------------编程问答--------------------
<!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 runat="server">
    <title>无标题页</title>
    <style type="text/css">
        body{ margin:0; padding:0;}
        table tr th,td{ text-align: center; background-color:#fff; height:30px;}
    </style>
</head>
<body>   
    <table style="width:100%; background-color:#ccc;" cellpadding="0" cellspacing="1">
        <tr>
            <td>这里是td</td>
        </tr>        
    </table>        
    <script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function() {
            $("table").height(document.documentElement.clientHeight);
        })
    </script>
</body>
</html>
--------------------编程问答-------------------- 是ie6下以版本可以,直接用js设置
jQuery(document).height() --------------------编程问答-------------------- 注意新旧标准,获取页面高度是不一样的
区别新旧标准的行是:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN” >
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>
--------------------编程问答-------------------- 注意新旧标准,获取页面高度是不一样的
 区别新旧标准的行是:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN” >
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional 
那新标准下面怎么设置呢? --------------------编程问答-------------------- 如果可以接收绝对定位的话

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <style type="text/css">

        body {
            margin:0;
            padding:0;
        }

        table {
            position:absolute;
            height:100%;
            width:100%;
        }

    </style>
</head>
<body>
    <form id="form1" runat="server">
    
    <table>
        <tr><td>hello world</td></tr>
    </table>

    </form>
</body>
</html>
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,