padding 与 margin

<!--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显示:

 

posted @ 2015-07-07 14:48  Seands  阅读(124)  评论(0)    收藏  举报
QQ:337573157      邮箱:Seands@126.com