html - 让项目在导航栏折叠时向左对齐(引导程序)
问题描述
我想要一个导航栏,其中项目默认向右对齐,但在导航栏折叠时,它们向左对齐。
这是我的 HTML:
<nav class="navbar">
<div class="container-fluid" width='300px'>
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html"><img src="img/UWCL_logo_white.png" alt="Gibbs Lab" style="width:80px;height:auto;"></a>
</div>
<div class="collapse navbar-collapse navbar-left " id="myNavbar">
<ul class="nav navbar-nav navText " style='list-style-type: square'>
<li ><a class="dropdown-divider" href="production/index.html" id="navText">About</a></li>
<li><a href="research/index.html" id="navText">Staff</a></li>
<li><a href="education/index.html" id="navText">Data Dashboards</a></li>
<li><a href="people/index.html" id="navText">Current Projects</a></li>
</ul>
</div>
</div>
</nav>
并且,当折叠时:
如何让这些项目(在第二张图片中)与页面左侧对齐?我尝试了以下方法,但没有运气:
.navbar-collapse {
text-align:left;
float:left;
}
谢谢你。
解决方案
将此类添加到您的ul标签:mr-auto
推荐阅读
- whatsapp - 我们可以在不使用 pywhatkit 打开浏览器的情况下发送 whatsapp 消息吗?
- google-cloud-platform - AWS CodePipeline 中是否有与手动批准操作等效的 Google CloudBuild?
- php - 创建带换行符的数组以重写 json (json_encode)
- python - 总结字典中的所有时间增量值
- oracle - 这个 FOR 循环中的 0 是什么意思
- linux - 在 awk 中使用 if 命令而不输入新行
- javascript - 验证以检查是否填写了必填字段,如果没有填写,则相应地打印错误消息
- r - 如何在R中以列表格式获取列的所有元素?
- python - ModuleNotFoundError:没有名为“odoo”的模块
- c++ - 在其他地图值中查找元素的最佳方法是什么?