在HTML/CSS中删除边距问题 [英] Issue removing margin with HTML/CSS
本文介绍了在HTML/CSS中删除边距问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我似乎无法成功用div完全填充水平空间.右,左,上和下总是有一点空间.
I cannot seem to succeed to completely fill a horizontal space with a div. There is always a little space at the right, left, top and bottom.
我当前正在使用:
CSS:
.section{
width: 100%;
display: inline-block;
top: 0px;
left: 0px;
margin: 0px;
padding: 0px;
}
#section-1,#section-3{
background-color: #ddd;
}
HTML:
<div id="section-1" class="section">
<p>Foo</p>
</div>
推荐答案
也将 margin:0
放在 body
body{
margin: 0;
}
通常要做的是将 html
和上的
,以使其能够完美地跨浏览器工作. margin
和 padding
都设置为 0
正文
What is generally done is setting margin
and padding
both to 0
on both html
and body
to make it work perfectly cross-browser.
html, body{
padding: 0;
margin: 0;
}
这篇关于在HTML/CSS中删除边距问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文