admin管理员组文章数量:1410737
I have a new problem that bugs me ...
I am making a web page that I want to be fixed with no scrolling and most important I want my main Div to fill aaaaaaaaall my available space...
I made this code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
".dtd">
<html xmlns="" xmlns:v="urn:schemas-microsoft-:vml">
<head>
<title>There is a @#!¤*-ing blank !</title>
<style type='text/css'>
html {margin:0px;padding:0px;height:100%;overflow:hidden;border: 3px solid green}
div {margin:0px;padding:0px;}
</style>
</head>
<body onload="document.getElementById('mydiv').style.height=document.getElementsByTagName('html')[0].offsetHeight+'px'"><div id="mydiv" style="margin:0px;padding:0px;width:100%;border: 2px solid red"></div></body>
</html>
As you can see I get a white space between my body element border and my div element border even though my body padding and div margin are set to 0...
I had once read "More Eric Meyer on CSS" that contains a solution to this issue but it was a long time ago and I don't remember ...
Any help would be greatly appreciated ^^.
I have a new problem that bugs me ...
I am making a web page that I want to be fixed with no scrolling and most important I want my main Div to fill aaaaaaaaall my available space...
I made this code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3/1999/xhtml" xmlns:v="urn:schemas-microsoft-:vml">
<head>
<title>There is a @#!¤*-ing blank !</title>
<style type='text/css'>
html {margin:0px;padding:0px;height:100%;overflow:hidden;border: 3px solid green}
div {margin:0px;padding:0px;}
</style>
</head>
<body onload="document.getElementById('mydiv').style.height=document.getElementsByTagName('html')[0].offsetHeight+'px'"><div id="mydiv" style="margin:0px;padding:0px;width:100%;border: 2px solid red"></div></body>
</html>
As you can see I get a white space between my body element border and my div element border even though my body padding and div margin are set to 0...
I had once read "More Eric Meyer on CSS" that contains a solution to this issue but it was a long time ago and I don't remember ...
Any help would be greatly appreciated ^^.
Share Improve this question asked Jun 29, 2009 at 13:08 Ar3sAr3s 2,3072 gold badges27 silver badges48 bronze badges4 Answers
Reset to default 7You didn't set the body's style:
body {margin: 0px; padding: 0px; height: 100%;}
Your body margin isn't set to 0px, just that of html.
Set the margin to 0 on the body tag.
body {margin:0;}
In addition - rather than adding:
padding: 0; margin: 0;
to every selector do it globally at the top of your CSS file:
* { padding: 0; margin: 0; }
本文标签: javascriptHTML blank I want to eraseStack Overflow
版权声明:本文标题:javascript - HTML blank I want to erase - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744897475a2631150.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论