gpt4 book ai didi

css - 如何让这个 Bootstrap 导航栏在移动设备上看起来整洁?

转载 作者:太空宇宙 更新时间:2023-11-04 12:52:41 24 4
gpt4 key购买 nike

可以看到live here .

这是手机上的截图:

Messed-up Mobile Navbar Bootstrap

这是经过 sanitizer 的 HTML:

    <header class="header">
<hgroup class="pull-left">
<h1 class="site-title">
<a rel="home" title="Von" href="index.html">
<i class="fa fa-lemon-o"></i> Von
</a>
</h1>
</hgroup>
<div id="togglesidebar" class="btn btn-primary pull-right">
<i class="fa fa-bars"></i>
</div>

<!-- Single button -->
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
Action <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div>

<!-- Search Bar -->
<div class="container">
<div class="row">
<div class="col-xs-6 col-xs-offset-2">
<div class="input-group">
<div class="input-group-btn search-panel">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span id="search_concept">Filter by</span> <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#contains">Contains</a></li>
<li><a href="#its_equal">It's equal</a></li>
<li><a href="#greather_than">Greather than ></a></li>
<li><a href="#less_than">Less than < </a></li>
<li class="divider"></li>
<li><a href="#all">Anything</a></li>
</ul>
</div>
<input type="hidden" name="search_param" value="all" id="search_param">
<input type="text" class="form-control" name="x" placeholder="Search term...">
<span class="input-group-btn">
<button class="btn btn-default" type="button"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
</div>
</div>
</div> <!-- /search-bar -->
</header> <!-- /header -->

在实时版本中, Logo 是 153px X 50px

更新 1:

经过 Darshak 的建议,这就是移动版的样子。更好,但仍需要调整。

Mobile-Menu-Responsive

最佳答案

试试这个。我尝试对您的设计和在您的结构中修改的某些类进行响应式查看。我把这个结构放在你给定的链接上。

<header class="header clearfix">
<div class="row masthead clearfix">
<hgroup class="col-xs-6 col-sm-6 col-md-3 col-lg-3">
<div class="site-title">
<a href="/">
<img alt="Ognrlogo" height="50" src="/assets/ognrlogo-232e94e86f40eeb3021490f5cf1e1a48.png" width="153" class="img-responsive" style="
margin: 0;
">
</a>
<br>
<span class="">On The Ground News Report</span>
</div>
</hgroup>

<div class="col-xs-6 col-sm-6 col-md-2 col-lg-2 masthead-group-2 text-right">
<ul class="nav navbar-nav navbar-right">
<!-- <li class="dropdown"> -->
<!-- <li> </li> -->
<!-- <li> </li> -->
<!-- </li> -->
<!-- <li> </li> -->
<!-- <li> </li> -->

<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
Login &amp; Join
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
<li role="presentation"><a href="/login" role="menuitem" tabindex="-1"><i class="fa fa-sign-in"></i> Login</a>
</li>
<li role="presentation"><a href="/register" role="menuitem" tabindex="-1"><i class="fa fa-sign-out"></i> Join</a>
</li>
</ul>
</div>
</ul>
</div>
<!-- /dropdown-parent-div -->

<!-- /search-box-parent -->


<div class="hidden-sm hidden-xs col-md-4 col-lg-4 masthead-group-2">
<div class="input-group">
<div class="input-group-btn search-panel">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span id="search_concept">Filter by</span> <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#contains">Contains</a>
</li>
<li><a href="#its_equal">It's equal</a>
</li>
<li><a href="#greather_than">Greather than &gt;</a>
</li>
<li><a href="#less_than">Less than &lt; </a>
</li>
<li class="divider"></li>
<li><a href="#all">Anything</a>
</li>
</ul>
</div>
<input type="hidden" name="search_param" value="all" id="search_param">
<input type="text" class="form-control" name="x" placeholder="Search term...">
<span class="input-group-btn">
<button class="btn btn-default" type="button"><span class="fa fa-search"></span>
</button>
</span>
</div>
</div>
<div class="hidden-sm hidden-xs col-md-3 col-lg-3 masthead-group-3">
<!-- <div id="togglesidebar" class="btn btn-primary pull-right">
<i class="fa fa-bars"></i>
</div> -->

<div id="togglesidebar" class="pull-right">
<button class="btn btn-default btn-lg btn-primary"><i class="fa fa-child"></i> Submit News</button>
</div>
</div>



</div>
<div class="row clearfix">
<div class="col-xs-12 col-sm-6 hidden-md hidden-lg masthead-group-2">
<div class="input-group">
<div class="input-group-btn search-panel">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span id="search_concept">Filter by</span> <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#contains">Contains</a>
</li>
<li><a href="#its_equal">It's equal</a>
</li>
<li><a href="#greather_than">Greather than &gt;</a>
</li>
<li><a href="#less_than">Less than &lt; </a>
</li>
<li class="divider"></li>
<li><a href="#all">Anything</a>
</li>
</ul>
</div>
<input type="hidden" name="search_param" value="all" id="search_param">
<input type="text" class="form-control" name="x" placeholder="Search term...">
<span class="input-group-btn">
<button class="btn btn-default" type="button"><span class="fa fa-search"></span>
</button>
</span>
</div>
</div>
<div class="col-xs-12 col-sm-6 hidden-md hidden-lg masthead-group-3">
<!-- <div id="togglesidebar" class="btn btn-primary pull-right">
<i class="fa fa-bars"></i>
</div> -->

<div id="togglesidebar" class="pull-right">
<button class="btn btn-default btn-lg btn-primary"><i class="fa fa-child"></i> Submit News</button>
</div>
</div>
</div>
<!-- /row -->
</header>

关于css - 如何让这个 Bootstrap 导航栏在移动设备上看起来整洁?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26051720/

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