Bootstrap 页脚导航栏问题

Posted

技术标签:

【中文标题】Bootstrap 页脚导航栏问题【英文标题】:Bootstrap footer navigation bar problems 【发布时间】:2017-10-13 17:40:01 【问题描述】:

由于某种原因,我的页脚导航栏在完整桌面模式下显示,一些菜单链接显示在与导航栏标题相同的行上,然后在经过导航栏标题时垂直居中...我只想要它们垂直显示在一行中并居中....

(当前显示) 导航栏标题链接 1 链接 2 链接 3 (我实际上希望它如何显示) 导航栏标题 链接 1 链接 2 链接 3
<div class = "container-fixed">
        <div class = "row" height = 100%>
            <div class = "col-sm-2 col-sm-offset-1">
                <!-- Footer About Dropdown -->
                <nav class = "navbar navbar-default" id = "bottomabout">
                    <div class = "container">
                       <div class = "navbar-header">
                            <button class = "navbar-toggle" data-toggle = "collapse" data-target = "#navbar-collapse">
                                <span class = "glyphicon glyphicon-plus"></span>
                            </button>
                            <h3 class = "text-center">
                                About Us
                            </h3>
                        </div>
                        <div class = "collapse navbar-collapse" id = "aboutcollapse">
                            <ul class = "nav nav-pills nav-stacked">
                                <li>
                                    <a href = "">
                                        OUR STORY
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        BABY REGISTRY
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        STORE LOCATOR
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        TESTIMONIALS
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </nav>
            </div>
            <div class = "col-sm-2">
                <!-- Service Footer Dropdown -->
               <nav class = "navbar navbar-default" id = "bottomservice">
                    <div class = "container">
                       <div class = "navbar-header">
                            <button class = "navbar-toggle" data-toggle = "collapse" data-target = "#navbar-collapse">
                                <span class = "glyphicon glyphicon-plus"></span>
                            </button>
                            <h3>
                                Service
                            </h3>
                        </div>
                        <div class = "collapse navbar-collapse" id = "aboutcollapse">
                            <ul class = "nav nav-pills nav-stacked">
                                <li>
                                    <a href = "">
                                        CONTACT US
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        ORDER STATUS
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        FAQ
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        SHIPPING POLICY
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        RETURN POLICY
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        NEWSLETTER
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        MY ACCOUNT
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        LIVE CHAT
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </nav> 
            </div>
            <!-- Shop Footer Dropdown -->
            <div class = "col-sm-2">
                <nav class = "navbar navbar-default" id = "bottomshop">
                    <div class = "container">
                       <div class = "navbar-header">
                            <button class = "navbar-toggle" data-toggle = "collapse" data-target = "#navbar-collapse">
                                <span class = "glyphicon glyphicon-plus"></span>
                            </button>
                            <h3>
                                Shop
                            </h3>
                        </div>
                        <div class = "collapse navbar-collapse" id = "aboutcollapse">
                            <ul class = "nav nav-pills nav-stacked">
                                <li>
                                    <a href = "">
                                        BABY APPAREL
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        BABY GIFTS
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                       CHRISTENING
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        FURNITURE
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        BEDDING
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        DECOR
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        LIGHTING
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        SALE
                                    </a>
                                </li>
                                <li>
                                    <a>
                                        BRANDS
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </nav> 
            </div>
            <!-- Contact Us Footer Dropdown -->
            <div class = "col-sm-2">
               <nav class = "navbar navbar-default" id = "bottomcontact">
                   <div class = "container">
                       <div class = "navbar navbar-header">
                           <button class = "navbar-toggle" data-toggle = "collapse" data-target = "#navbar-collapse">
                                <span class = "glyphicon glyphicon-plus"></span>
                            </button>
                            <h3>
                                Contact Us
                            </h3>
                       </div>
                       <div class = "collapse navbar-collapse">
                           <ul class = "nav nav-pills nav-stacked active">
                               <li>
                                   <h6>
                                      <b>
                                        BEAUTIFUL BEGINNINGS
                                      </b> 
                                   </h6>
                               </li>
                           </ul>
                       </div>
                   </div>
               </nav>
            </div>
            <div class = "col-sm-2">
                <h3>
                    Follow Us
                </h3>
                <button type="button" class="btn btn-fb"><i class="fa fa-facebook"></i></button>
            </div>
        </div>
    </div>

【问题讨论】:

【参考方案1】:

如果您删除容器,它将按您的意愿工作。 检查以下内容:

            <nav class = "navbar navbar-default" id = "bottomabout">
                   <div class = "navbar-header">
                            <button class = "navbar-toggle" data-toggle = "collapse" data-target = "#navbar-collapse">
                                <span class = "glyphicon glyphicon-plus"></span>
                            </button>
                            <h3 class = "text-center">
                                About Us
                            </h3>
                        </li>
                        <li class = "collapse navbar-collapse" id = "aboutcollapse">
                            <ul class = "nav nav-pills nav-stacked">
                                <li>
                                    <a href = "">
                                        OUR STORY
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        BABY REGISTRY
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        STORE LOCATOR
                                    </a>
                                </li>
                                <li>
                                    <a href = "">
                                        TESTIMONIALS
                                    </a>
                                </li>
                            </ul>
                        </div>

                </nav>

【讨论】:

谢谢!它现在几乎可以工作了,每个部分的第一个链接都与标题在同一行开始,但至少所有内容都不是到处都是啊哈哈 实际上我错过了一些它现在正在工作的东西,你是最棒的!!非常感谢!! 别担心,别忘了把它标记为正确答案,谢谢队友:)

以上是关于Bootstrap 页脚导航栏问题的主要内容,如果未能解决你的问题,请参考以下文章

导航栏和粘性 Bootstrap 页脚之间的 100% 高度

Bootstrap 3移动键盘解锁导航栏[重复]

导航栏、正文和页脚的滚动问题

使用导航栏引导静态页脚[重复]

网站搭建 (第04天) 导航栏与页脚

Bootstrap滚动监听