
说明
1、如果一侧定值,包括不设定值取默认值0的情况,一侧auto,则auto为剩余空间大小。
2、如果两侧均是auto,则平分剩余空间。
实例
<style>
.father{
width:300px;
background-color:#f0f3f9;
}
.son{
width:200px;
height:120px;
margin-right:80px;
margin-left:auto;
background-color:#cd0000;
}
</style>
<div>
<div></div>
</div>
以上就是css margin:auto的填充规则,希望对大家有所帮助。更多css学习指路:css教程
原文来自:https://www.py.cn© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END



















































暂无评论内容