* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html,
body {
margin: 0;
padding: 0;
}
nav {
display: flex;
background: #303f62;
height: 150px;
}
ul {
display: flex;
padding: 0;
height: 125px;
flex-wrap: wrap;
padding: 10px;
flex-direction: row;
justify-content: space-evenly;
align-items: center;
}
.left {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: flex-start;
margin-top: 15px;
margin-right: auto;
}
.right {
margin-top: 15px;
margin-left: auto;
margin-right: 10%;
}
ul>a {
margin-right: 5px;
width: 150px;
border: 1px solid transparent;
text-align: center;
color: #fff;
background: #1e625b
}
ul>a:hover {
background: #29857d;
cursor: pointer;
}
aside {
display: flex;
justify-content: center;
align-items: center;
width: 20%;
height: 600px;
min-width: 220px;
background: #303f62;
}
aside .links {
flex-direction: column;
justify-content: center;
align-items: center;
}
.links>a {
text-decoration: none;
color: #fff;
}
.links>a:visited {
text-decoration: none;
color: #fff;
}
/*Media Queries*/
@media all and (max-width: 920px) {
ul {
flex-direction: column;
}
ul a {
margin-right: 0;
margin-bottom: 5px;
}
}
<nav>
<div class="left">
<img src="logo1.jpg" alt="Лого">
</div>
<div class="right">
<ul>
<a>Главная</a>
<a>О нас</a>
<a>Контакты</a>
<a>Сотрудники</a>
</ul>
</div>
</nav>
<div class="section">
<aside>
<div class="links">
<a href="#">Статьи</a>
<a href="#">Домой</a>
<a href="#"></a>
<a href="#"></a>
<a href="#"></a>
</div>
</aside>
</div>
问题:为什么 .links 块中的链接不排成一列?以及如何让它们排成一列
aside .links除非明确设置,否则附加display: flex属性不会从display父级继承因为你
ul必须flex-direction: row;用rowcolumn