我尝试制作一个固定导航栏和两个固定导航栏,它们位于固定导航栏上。
实际上,我有一个固定的导航栏,并且有一个位于固定导航栏上的导航栏。第一个粘性导航栏位于左侧,并且可以工作,但是当我尝试将第二个粘性导航栏向右浮动时,它停留在第一个粘性导航栏的左侧。 这是我在wix.com上所做的示例:Example
<!--Navigation-->
<nav class="navbar navbar-expand-lg navbar-light bg-dark">
<a class="navbar-brand d-lg-none" href="#">Fabicki.de</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav mx-auto">
<li class="nav-item">
<a class="nav-link px-lg-4" href="">Start <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle px-lg-4" href="#" id="navbarDropdownMenuLink" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Unser Angebot
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="tueren">Türen</a>
<a class="dropdown-item" href="fenster">Fenster</a>
<a class="dropdown-item" href="sonstiges">Sonstiges</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link px-lg-4" href="#ueberuns">Über uns</a>
</li>
<li class="nav-item">
<a class="nav-link px-lg-4" href="#projekte">Projekte</a>
</li>
</ul>
</div>
</nav>
<!--Navigation-->
<!--Logonav-->
<nav class="navbar sticky-top position-fixed navbar-dark bg-purple round-rb shadow">
<a class="navbar-brand mx-5 d-inline-flex" href="">
<img src="{% static 'web/images/Logo_transparent_klein.png' %}" height="73" alt="Startseite">
<div class="col my-auto">
<span class="h4 ml-5 m">
<b>F.T.F.</b>
</span><br>
<span class="ml-5">
FABICKI
</span>
</div>
</a>
</nav>
<!--Logonav-->
<!--second nav (a btn)-->
<nav class="navbar fixed-top navbar-dark bg-purple round-b mr-5 shadow">
<a class="navbar-brand mx-3" href="#kontakt"><b>Kontakt</b></a>
</nav>
<!--second nav (a btn)-->
答案 0 :(得分:0)
不要那样做三个导航栏!试试这个应该可以的
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<!--This is your first NavBar with Image on Left Side-->
<img class="img-responsive nav navbar-nav navbar-left" src="umbrella.png"> <!-- Put Your Logo Image Here-->
</img>
<!--This is your second Navbar with links and other stuffs-->
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Page 1</a></li>
<li><a href="#">Page 2</a></li>
<li><a href="#">Page 3</a></li>
</ul>
<!--This is your third Navbar with your custom text-->
<ul class="nav navbar-nav navbar-right">
<a href="#"><b>Kontakt</b></a>
</ul>
</div>
</nav>
<h1>Scroll this page to see the effect</h1>
</body>
</html>
答案 1 :(得分:0)
这有效。我将徽标放在容器中并与btn联系,然后使用float-right。现在我有两个导航。
<!--Navigation-->
same as my first post
<!--Navigation-->
<!--Second nav-->
<div class="container-fluid sticky-top ml-n3 position-fixed">
<nav class="navbar sticky-top position-fixed navbar-dark bg-purple round-rb shadow">
<a class="navbar-brand mx-5 d-inline-flex" href="">
<img src="{% static 'web/images/Logo_transparent_klein.png' %}" height="73" alt="Startseite">
<div class="col my-auto">
<span class="h4 ml-5 m">
<b>F.T.F.</b>
</span><br>
<span class="ml-5">
FABICKI
</span>
</div>
</a>
</nav>
<nav class="navbar sticky-top float-right navbar-dark bg-purple round-b mr-5 shadow">
<a class="navbar-brand mx-3" href="#kontakt"><b>Kontakt</b></a>
</nav>
</div>
<!--Second nav-->