ES6-Flex布局(元素布局)
作者:
测试探索 | 来源:发表于
2022-07-17 09:54 被阅读0次一、元素项(Flex Item)的属性

image.png
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>flex布局</title>
<style type = "text/css">
.container{
width: 600px;
height: 600px;
margin: 0 auto;
background-color:beige ;
display: flex;
/*元素项排列方式*/
flex-direction: row;
/*内容是否换行*/
/*flex-wrap: wrap;*/
/*!*水平居中对齐*!*/
/*justify-content: center;*/
/*!*垂直轴对齐方式*!*/
/*align-items: center;*/
}
.container div{
width: 250px;
height: 100px;
}
.first{
order: 2;
background-color: #f00;
}
.second{
order: 1;
background-color: #ff0;
}
.third{
order: 3;
background-color: #00f;
}
</style>
</head>
<body>
<div class = "container">
<div class = "first">1</div>
<div class = "second">2</div>
<div class = "third">3</div>
</div>
</body>
</html>

image.png
本文标题:ES6-Flex布局(元素布局)
本文链接:https://www.haomeiwen.com/subject/cjcgbrtx.html
网友评论