我需要将元素#center-navigation
相对于页面中心居中,然后将另外两个元素放置在它的左侧(#logo
)和右侧(#contacts
)。目前在我的实现中,#center-navigation
没有居中于页面上。使用Flexbox布局能否实现此功能?
#row {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
#logo {
height: 20px;
width: 80px;
background-color: red;
margin-right: auto;
}
#contacts {
margin-left: auto;
}
h1 {
text-align: center;
}
<div id="row">
<div id="logo">
</div>
<div id="center-navigation">
Some navigation here
</div>
<div id="contacts">
example@mail.org
</div>
</div>
<h1>
Some long website title goes here
</h1>