gpt4 book ai didi

css - 带 Bootstrap 和 Angular 的固定顶部导航栏

转载 作者:行者123 更新时间:2023-12-02 06:00:12 25 4
gpt4 key购买 nike

我拿不到固定顶navbar工作于 Angular 。我的主app.component模板是:

<page-header></page-header>
<router-outlet></router-outlet>

Bootstrap 导航栏包含在我的页面标题中:

<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Project name</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="../navbar/">Default</a></li>
<li><a href="../navbar-static-top/">Static top</a></li>
<li class="active"><a href="./">Fixed top <span class="sr-only">(current)</span></a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>

我的路由器 socket 高度为 300%。我现在想要实现的是页眉保持固定在顶部。这对于 Angular 和 bootstrap 4 来说是可能的吗?

最佳答案

通过将 navbar-fixed-top 更改为仅 fixed-top 来修复此问题

关于css - 带 Bootstrap 和 Angular 的固定顶部导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46661433/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com