html5-伸缩布局常用属性flex
作者:
AssertDo | 来源:发表于
2019-08-27 14:33 被阅读0次<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
*{
padding: 0;
margin: 0;
}
.box{
width: 100%;
height: 500px;
background-color: #ccc;
margin:0 auto;
/*设置父容器的为伸缩盒子*/
display: flex;
/*设置子元素在主轴方向上的排列方式*/
/*justify-content: flex-start;*/
}
.left{
/*flex是用来设置当前伸缩子项占据剩余空间的比例值*/
flex: 1;
height: 500px;
background-color: red;
}
.right{
flex: 4;
height: 500px;
background-color: blue;
}
</style>
</head>
<body>
<div class="box">
<div class="left"></div>
<div class="right"></div>
</div>
</body>
</html>
本文标题:html5-伸缩布局常用属性flex
本文链接:https://www.haomeiwen.com/subject/gpdeectx.html
网友评论