首页 > 其他 > 详细

padding 与 margin

时间:2015-07-07 16:14:12      阅读:95      评论:0      收藏:0      [点我收藏+]
<!--DOCTYPE HTML -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src=""></script>
<script type="text/javascript">
</script>
<style>
* {
    margin: 0px;
    padding: 0px;
    border: 0px;
}

body {
    background-color: #efefef;
}
    
.static {
    width: 100px;
    height: 100px;
    background-color: #fedcbd;
    margin: 30px;
    padding: 20px;
    position:static;
}

.relative {
    width: 100px;
    height: 100px;
    background-color: #b2d235;
    margin: 30px;
    padding: 20px;
    position: relative;
}

.absolute {
    width: 100px;
    height: 100px;
    background-color: #1f1f1f;
    margin: 30px;
    padding: 20px;
    position: absolute;
}

.abc {
    width: 100px;
    height: 100px;
    margin: 30px;
    padding: 20px;
    background-color: #3d3d3d;
}
</style>

</head>

<body>
<div class="static">static</div>
<div class="relative">relative</div>
<div class="absolute">absolute</div>
<div>总结:如果不加上页面头标记的话,IE会采用IE盒子模型,与谷歌浏览器显示div的大小不同</div>
</body>

IE显示:技术分享

 

google显示:

技术分享

 

padding 与 margin

原文:http://www.cnblogs.com/Seands/p/4626973.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!