批改状态:合格
老师批语:布局是前端的知识的集成, 很有趣的
display: flex;flex-wrap: wrap;换行显示,多行排列
justify-content: start;左对齐
justify-content: end;右对齐
stify-content: center;中间对齐
justify-content: space-between;两端对齐
justify-content: space-around;分散对齐:剩余空间在所有项目的两边平均分配
justify-content: space-evenly;平均分配,项目之间的间距相等
align-content: flex-start;多行上对齐
align-content: flex-end;多行下对齐
align-content: center;多行中对齐
align-content:space-between;两端对齐
align-content: space-around;分散对齐:剩余空间在所有项目的两边平均分配
align-content: space-evenly;平均分配,项目之间的间距相等
flex-direction: row;行flex-direction: column;列代码如下:
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>flex容器属性实战:快速撸一个导航</title></head><style>*{padding: 0;margin: 0;box-sizing: border-box;}a{text-decoration: none;color: #cccccc;}nav{height: 40px;background-color: #333;padding: 0 50px;display: flex;}nav a{height: inherit;line-height: 40px;padding: 0 15px;}nav a:hover{background-color: seagreen;color: white;}nav a:last-of-type{margin-left: auto;}</style><body><header><nav><a href="">首页</a><a href="">教学视频</a><a href="">社区问答</a><a href="">资源下载</a><a href="">登录/注册</a></nav></header></body></html>

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号