html - 在 Bootstrap 中将导航栏向右移动

标签 html css twitter-bootstrap web

我一直在尝试使用 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;
}

这是笔:Working Example (CodePen)

关于html - 在 Bootstrap 中将导航栏向右移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45910806/

相关文章:

html - Bootstrap 淡入淡出轮播急剧改变图像而不是过渡

html - 包装内内容的全高侧边栏

html - 当我调整浏览器大小时,css 容器没有调整

css - float 和水平边距

javascript - 如何在按钮单击事件中隐藏占位符?

jquery - textarea 填充 jsfiddle 中的表格单元格但不在实际应用程序中

html - 如何在 WordPress 中隐藏用户仪表板详细信息?

html - Paypal html 表单不起作用

css - Bootstrap Timeline - 跨线面板

javascript - 带有reactjs和bootstrap的下拉菜单