作业内容:实例演示flex容器与项目中常用的属性,并写出功能。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
font-size: 10px;
}
body {
font-size: 1.6rem;
}
.container {
border: 1px solid;
width: 29em;
height: 20em;
display: flex;
/* flex-wrap: nowrap; *//* 默认不换行 */
/* flex-wrap: wrap;//换行 */
/* flex-direction: row; 行的方向*/
/* flex-direction: row-reverse;反向 */
/* flex-direction: column;列的方向 */
/* 简写: */
/* flex-flow: row wrap;主轴方向换行 */
/* justify-content: flex-start; */
/* justify-content: flex-end; */
/* justify-content: space-between;两端对齐 */
/* justify-content: space-around;分散对齐 */
/* justify-content: space-evenly;平均对齐 */
/* flex-basis: 25em;项目在主轴上的宽度 */
/* flex-shrink: 0;不收缩 */
/* flex-shrink: 1;收缩 */
/* flex-grow: 0;禁止放大 */
/* flex-grow: 1;允许放大 */
/* flex: 0 1 auto;禁止放大 允许收缩 宽度自动 */
}
.container>.item {
padding: 1em;
border: 1px solid;
background-color: aquamarine;
}
</style>
</head>
<body>
<div class="container">
<div class="item">item1</div>
<div class="item">item2</div>
<div class="item">item3</div>
<div class="item">item4</div>
</div>
</body>
</html>