我一直在尝试使用 float: right; 将 bootstrap4 中的导航栏移动到屏幕的右侧;在导航 a 上,它什么也没做。我正在使用 Codepen 应用程序为我正在做的元素编写代码。
HTML代码:
<div class="container-fluid">
<class="row">
<header>
<nav class="navbar navbar-fixed-top">
<a href="#" class="glyphicon glyphicon-user">About</a>
<a href="#" class="glyphicon glyphicon-th-large">Portfolio</a>
<a href="#" class="glyphicon glyphicon-envelope">Contact</a>
</div>
</nav>
</header>
</div>
</div>
</body>
</html>
CSS 文件:
@import url('//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css');
nav a {
color: black;
padding: 10px;
font-size: 32px;
background-color: gray;
}
最佳答案
它工作正常,只需在您的 CSS 中添加 float: right !important;
@import url('//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css');
nav a {
color: black;
padding: 10px;
font-size: 32px;
background-color: gray;
float: right !important;
}
关于html - 在 Bootstrap 中将导航栏向右移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45910806/