老师,另外问一个问题,我们在使用flex布局,应该是每一个元素上都应该写上dispaly:flex吧
来源:3-10 编程练习
superman888
2020-08-21 11:40:59
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
*{margin: 0;padding: 0;}
header{width: 100%;display: flex;flex-direction: row;justify-content: space-around;background: black;}
.logo{display: inline-flex;align-content: center;justify-content: space-between;}
.nav{display: inline-flex;justify-content: space-between;}
.nav li{width: 150px;list-style:none;font-size: 20px;color: white;display: inline-flex;justify-content: center;align-items: center;}
.login{display: inline-flex;width: 100px;justify-content: space-between;align-items: center;}
input{background: orange;width: 35px;height: 20px;border-radius: 6px;
border: none;color: white;}
</style>
</head>
<body>
<header>
<div class="logo">
<img src="http://climg.mukewang.com/59feb59700019dab01910057.png" alt="">
</div>
<ul class="nav">
<li>课程</li>
<li>路径</li>
<li>猿问</li>
<li>手记</li>
</ul>
<div class="login">
<input type="button" value="登录">
<input type="button" value="注册">
</div>
</header>
</body>
</html>
1回答
同学你好,代码布局以及实现效果很棒!
针对提问回复:
如果子元素需要flex布局排列,那么在父元素添加display:flex;即可,子元素可以不添加。例如中间导航项中可以这样修改
祝学习愉快!
相似问题