Thanks in advance ! I tried float, margin, and padding nothing without any help, I wanted to be just sticked to the top corner of the background ... screen shot of the problem
问问题
96 次
5 回答
2
That space is (probably) the body's, not the element's.
body {
margin: 0;
padding: 0;
}
Hard to tell because I can't see the code inside your <body>
tag in the screenshot, but almost certainly that's the issue.
于 2013-07-13T14:53:41.887 回答
0
Add these to your css:
body, html {
margin: 0;
padding: 0;
}
.element {
position: absolute;
top: 0;
left:0;
}
于 2013-07-13T14:54:48.657 回答
0
每当我开始一个新项目时,我的css文件中总是有这个
*{
margin:0;
padding:0;
/* Optional Below */
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
}
这会重置所有内容的填充和边距( not:box-sizing )。
于 2013-07-13T15:38:34.190 回答
0
还可以考虑使用css reset它有助于解决浏览器不一致问题。
于 2013-07-13T14:56:05.323 回答
0
您可以使用 CSS 重置工具重置所有浏览器默认样式,例如在默认 css 文件的顶部添加以下规则。
html{color:#000;background:#FFF}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,select{margin:0;padding:0}table{border-collapse:collapse;border-spacing:0}fieldset,img{border:0}/*address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal}*/ol,ul{list-style:none}caption,th{text-align:left}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}q:before,q:after{content:''}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:text-top}sub{vertical-align:text-bottom}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit}input,textarea,select{*font-size:100%}legend{color:#000}
于 2013-07-13T15:03:18.507 回答