星空网 > 软件开发 > 网页设计

body在默认情况下是具有margin外边距的

body在默认情况下是具有margin外边距的:
这里只是陈述一个事实,那就是body具有外边距在默认情况下。
代码实例如下:

<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>蚂蚁部落</title><style type="text/css"> body{ background:blue;}#box{ width:200px; height:100px; background:red; text-align:center; line-height:100px;}</style></head><body><div id="box">蚂蚁部落</div></body></html>

从上面的代码可以看出,box元素与外围有一定的空隙,再来看一段代码实例:

<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>蚂蚁部落</title><style type="text/css"> body{ background:blue; margin:0px;}#box{ width:200px; height:100px; background:red; text-align:center; line-height:100px;}</style></head><body><div id="box">蚂蚁部落</div></body></html>

上面的代码可以看出,空隙消失,说明body是具有外边距的。
所以在正式些页面之前,通常先重置一下样式属性,具体可以参阅css预重置样式代码一章节。

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=18131

更多内容可以参阅:http://www.softwhy.com/divcss/




原标题:body在默认情况下是具有margin外边距的

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

shopee广告充值:https://www.goluckyvip.com/tag/25003.html
shopee广告投放:https://www.goluckyvip.com/tag/25004.html
shopee广告投放代运营:https://www.goluckyvip.com/tag/25005.html
shopee活动:https://www.goluckyvip.com/tag/25006.html
shopee货代:https://www.goluckyvip.com/tag/25007.html
shopee货到付款:https://www.goluckyvip.com/tag/25008.html
2024.03.29亚马逊选品推荐(仅供参考):宠物饮水机滤芯片:https://www.kjdsnews.com/a/1836532.html
想要搞钱,就去做离搞钱最近的事:https://www.kjdsnews.com/a/1836533.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流