使用说明
1、用来增加元素间距的,外边距跟边框一样,分为上、右、下、左4个方向的边距。
2、margin可以沿着四个不同的方向(top,right,bottom,left)添加,所以在深入研究示例和用例之前,一定要阐明一些基本概念,这一点非常重要。
实例
div{
width: 200px;
height: 200px;
}
.box1{
background: red;
margin-bottom: 20px;
//margin-bottom: 20px 50px;
//margin: auto;
//margin-top: -100px;
}
.box2{
background: blue;
}
以上就是css外边距margin的介绍,希望对大家有所帮助。更多css学习指路:css教程
本文教程操作环境:windows7系统、css3版,DELL G3电脑。
相关


