Navbar小分辨率变为两行

时间:2014-07-30 05:18:24

标签: html css twitter-bootstrap twitter-bootstrap-3

当我折叠它时,我的导航栏会一直转换为两行。我尝试使用我将在导航条代码后发布的CSS更正它。不幸的是,这完全取消了我的下拉菜单并将其分解成小于实际菜单按钮的按钮。我是html / css的新手,我刚刚在过去的四天里学到了它。我还在主navbar类中尝试了另一个类nowarp的方法,这也产生了黯淡的结果。

注意:如果我能够在没有所有复杂的CSS的情况下做到这一点,我试图从另一个问题中学到一半,我会非常感激。

<!-- Navbar -->
    <nav class="navbar navbar-default" role="navigation">
        <div class="container-fluid">
            <div class="navbar-header">
                <!-- Navigation Bar Menu Button for Smaller Resolutions -->
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#example-nav-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 class="navbar-inner">
                    <!-- Logo -->
                    <a class="brand visible-xs-inline" href="index.html"> <img id="cherry" src="img/cheery3.svg"></a>
                    <!-- Small Resolution Navigation Label -->
                    <div class="navbar-right visible-xs-inline">
                        <ul class="nav navbar-nav">
                            <li><a id="nav-label" href="#">Navigation <span class="glyphicon glyphicon-arrow-right"></span></a></li>
                        </ul>
                    </div>
                </div>
            </div>
            <!-- General Links to Other Pages -->
            <div class="collapse navbar-collapse" id="example-nav-collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li class="visible-sm visible-md visible-lg"><a id="cherrybox" href="#"><img id="cherrytoo" src="img/cheery4.svg" alt=""></a></li>
                    <li class="active"><a href="index.html">Home</a></li>
                    <li><a href="bitcoin/index.html">Bitcoin</a></li>
                    <li><a href="#">Services</a></li>
                    <li><a href="#">Contact Us</a></li>
                </ul>
            </div>
        </div>
    </nav>

破碎的CSS

/*Important Small Resolution Fixes Section!*/
.navbar-left {float: left !important;}

.navbar-right {float: right !important;}
@media(max-width:767px)
{
.navbar-right {margin-right:20px;}
.navbar-header:after 
{
clear: none;
}
.navbar-nav.navbar-right > li { float: left; }

.navbar-collapse:before {clear:both;}

.navbar-collapse {overflow-y: hidden;}
.navbar-collapse.in {overflow-y: visible;}

.navbar-collapse.in > ul {border-top: 1px double #101010;}
}
.navbar-brand {
font-size: 25px;
line-height: 10px;
padding-bottom: 5px;
}
.logo_tagline {
text-transform: uppercase;
font-size: 10px;
letter-spacing: 2px;
color:#bbb;
}
}
/*End Fixes for Small Resolution*/

1 个答案:

答案 0 :(得分:0)

不完全确定你的目标是什么,但这是我最好的猜测。为此,我几乎将您的代码还原回Bootstrap默认导航栏。然后我用“导航”和另一个字形替换组成切换按钮的3个水平条。

<!-- Navbar -->
    <nav class="navbar navbar-default" role="navigation">
        <div class="container-fluid">
            <div class="navbar-header">
                <!-- Navigation Bar Menu Button for Smaller Resolutions -->
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#example-nav-collapse">
                  Navigation <span class="glyphicon glyphicon-th-large"></span>
                </button>

            </div>
            <!-- General Links to Other Pages -->
            <div class="collapse navbar-collapse" id="example-nav-collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li class="visible-sm visible-md visible-lg"><a id="cherrybox" href="#"><img id="cherrytoo" src="img/cheery4.svg" alt=""></a></li>
                    <li class="active"><a href="index.html">Home</a></li>
                    <li><a href="bitcoin/index.html">Bitcoin</a></li>
                    <li><a href="#">Services</a></li>
                    <li><a href="#">Contact Us</a></li>
                </ul>
            </div>
        </div>
    </nav>

如果这不是你想要的,请更清楚地解释你想要的东西,也许是问题的样片/图片。