gpt4 book ai didi

css - Bootstrap 导航栏导航向右拉,但在折叠时向左拉

转载 作者:行者123 更新时间:2023-11-28 09:12:50 26 4
gpt4 key购买 nike

我已经将我的导航栏导航链接构建为向右拉(这是我想要的)但是在折叠时链接也向右拉,这看起来很奇怪(见图)。我想弄清楚如何修改代码,以便导航在折叠时向左拉。 Demo

Navbar FullScreen - ok

Navbar Collapse

如果你能帮上忙,请告诉我。

我的模板代码和站点特定的 css 如下:

    ![<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
<link href="/static/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="/static/css/site-specific.css" rel="stylesheet">
</head>

<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar- collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse pull-right">
<ul class="nav navbar-nav pull-left">
<li><a href="{{ url_for('index') }}">Home</a></li>
<li><a href="{{ url_for('about') }}">About</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Browse by Neighbourhood<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="{{ url_for('notting_hill') }}">Notting Hill</a></li>
<li><a href="{{ url_for('marylebone') }}">Marylebone</a></li>
<li><a href="{{ url_for('west_end') }}">West End</a></li>
<li><a href="{{ url_for('mayfair') }}">Mayfair</a></li>
<li><a href="{{ url_for('soho') }}">Soho</a></li>
<li><a href="{{ url_for('covent_garden') }}">Covent Garden</a></li>
<li><a href="{{ url_for('chelsea') }}">Chelsea</a></li>
<li><a href="{{ url_for('camden') }}">Camden</a></li>
<li><a href="{{ url_for('shoreditch') }}">Shoreditch</a><li>
<li><a href="{{ url_for('tower_bridge') }}">Tower Bridge</a><li>
<li><a href="{{ url_for('index') }}">All</a><li>
</ul>
</li>
<li><a href="{{ url_for('contact') }}">Contact</a></li>
</ul>
</div><!--.nav-collapse-->
</div>
</div>

<h1>LONDON</h1>


{% block content %}{% endblock %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
</body>
</html>

.navbar {
background-color: #33B833;
font-family: 'Raleway', sans-serif;}

.navbar .nav > li > a {
color: #ffffff;}

.navbar .nav > li > a:hover {
color: #000000;}

.navbar-inverse .navbar-nav > .open >a:hover, .navbar-inverse .navbar-nav > .open >a:focus, .navbar-inverse .navbar-nav > .open >a {
background-color: #33CC33;
}][4]

最佳答案

我终于想通了 - 应该是 .navbar-right 而不是 .pull-right!希望这对将来的人有所帮助!

关于css - Bootstrap 导航栏导航向右拉,但在折叠时向左拉,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25383921/

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