码迷,mamicode.com
首页 > 其他好文 > 详细

padding 与 margin

时间:2015-07-07 16:16:26      阅读:134      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!