下面 主要代碼 方便看。
樣式 <style> *{ margin:0; padding:0; } html{ height:100%;/*關鍵代碼*/ } body{ height:100%;/*關鍵代碼*/ } .bboo{text-align:center;font-family:'微軟雅黑';font-size:16px} </style> 引用 <script type="text/javascript" charset="utf-8" src="../js/jquery-1.7.2.min.js"></script> //初次加載 function init() { var wContact=$('body').height()-$('.bboo').outerHeight(); var w=wContact-460; $('.bboo').css('padding-top',w); } 具體就不寫了 </head> <body> 這里 可以是input 或者別的東西 <div class="bboo"> 這里就是最后一行 ,隨便寫點什么 </div> </div> </body> </head>
鏈接:親測可以用,里面比較復雜,上面是簡化的。 http://blog.csdn.net/asuncat/article/details/52084466
<style> *{ margin:0; padding:0; } html{ height:100%;/*關鍵代碼*/ } body{ background-color:#fff; font-size:14px; color:#222; width:100%; height:100%;/*關鍵代碼*/ }