css样式中的margin也就是css中外边距外间距属性,顾名思义,就是控制div块或者各元素之间上下左右的距离,显然margin在css中的作用不容小觑。本篇文章就给新手小白介绍关于cssmargin属性的具体用法。希望对大家有所帮助。
下面我们通过具体的代码示例详细解说
css中margin属性即css外边距属性的具体用法代码示例:
css中的margin属性使用示例.demo{
width:300px;height:100px;
background-color:#ccccff;
}
.demo1{
margin-left:50px;
margin-top:50px;
margin-bottom:50px;
width:300px;height:100px;
background-color:#b2ecef;
}
.demo2{
width:300px;height:100px;
background-color:#94ef9a;
}
.demo1p{margin-left:50px;
}
没有给这个div块设置margin值