日期:2014-05-17 浏览次数:20760 次
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title><!-- Insert your title here --></title> <style type="text/css"> html, body { height: 100%; margin: 0px; padding: 0px; } </style> </head> <body> <div style="position: fixed; left: 20%; top: 20%; width: 60%; height: 60%; background: #FFEEEE;">abcdef</div> <!-- Insert your content here --> </body> </html>
------解决方案--------------------
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html;charset=gb2312" /> </head> <body> <div id="div1" style="height: 100%;background-color: #FFCC66">11</div> </body> </html>
------解决方案--------------------
我试了下3楼的代码,如果网页顶上加一行
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
就不行了,似乎是个兼容性问题?
------解决方案--------------------
jquery 写的!
$(document).ready(function(){ var height = document.documentElement.clientHeight ; $("#main_data").height(height) ; });
------解决方案--------------------
。。。。解释为了解决你这个问题才不加DOCTYPE的。你有特殊要求一定要加?