【发布时间】:2018-12-28 13:45:17
【问题描述】:
我正在使用 CSS 框架 Bulma(第一次),虽然我的问题可能不是 Bulma 特定的,但我想我会包括清楚。
我有一个导航栏,它有一组居中的链接,但也有右对齐元素。截图如下:
您可以忽略左侧的固定叶子。我想知道如何让购物车和登录按钮右对齐,同时让其他位居中对齐。
这是我尝试过的codepen。我只是不知道让汽车和登录正确对齐的正确方法。我的意思是我可以绝对定位它们,但这听起来很傻。
HTML 代码
<nav class="navbar is-fixed-top">
<a href="">Products</a>
<a href="">Our Story</a>
<div id="logo">Logo placeholder</div>
<a href="">Blog</a>
<a href="">Contact Us</a>
</nav>
CSS 代码
nav {
display: flex;
width: 100%;
height: 100px;
align-items: center;
justify-content: center;
}
nav a {
text-decoration: none;
color: #194522;
font-weight: bold;
margin: 0 40px;
display: flex;
align-items: center;
}
nav a:hover {
color: #abcf39;
}
我怎样才能获得这样的导航?
【问题讨论】: