本文介绍了删除CSS中的主体边距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚接触网络开发,在移除身体边缘时遇到了问题。
I'm new to web development, and met a problem when removing margin of body.
浏览器顶部和logo文本之间有空格。我的代码是。
如果我想删除空格,是 body {margin:0;}
错了吗?
Is body { margin: 0;}
wrong if I'd like to remove the space?
推荐答案
我会说使用:
* {
margin: 0;
padding: 0;
}
是解决这个问题的坏方法。
is a bad way of solving this.
h1边距弹出父母的原因是父母没有填充。
The reason for the h1 margin popping out of the parent is that the parent does not have a padding.
如果您向
将所有填充和边距重置为0可能会导致很多副作用。然后,最好删除此特定标题的margin-top。
Resetting all paddings and margins to 0 can cause a lot of side effects. Then it's better to remove margin-top for this specific headline.
这篇关于删除CSS中的主体边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!