修改Bootstrap的导航栏

时间:2015-09-15 00:38:45

标签: twitter-bootstrap twitter-bootstrap-3

我已将一种填充样式应用于#my_account li。但是我不希望在导航栏折叠时应用该样式。

有人知道只有当导航栏没有折叠时我才能拥有这种风格吗?谢谢!

CSS

#my_account {
    padding-left: 60px;
}

HTML

 <nav class="navbar navbar-default navbar-static-top' role='navigation' ">
    <div class="fluid" >
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#nav_bar_collapsed" aria-expanded="false">
            <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="collapse navbar-collapse" id="nav_bar_collapsed">
                <ul class="nav navbar-nav">
                    <li>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">My Projects</a>
                    </li>
                    <li>
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            Freelancers
                            <span class="caret"></span>
                            <ul class="dropdown-menu">
                                <li>
                        <a href="#">Manage Hired Freelancers</a></li>
                        <li><a href="#">Manage Applicants</a></li>
                        </ul>
                        </a>
                    </li>
                    <li><a href="#">Project To Do List</a></li>
                    <li><a href="#">Inbox</a></li>
                    <!-- Email Templates , Account Setting, Finical Summary, Contact Us Log Out-->
                    <li id="my_account"><a href="#">My Account</a> </li>
                </ul>
            </div>
        </div>
    </div>
</nav>

1 个答案:

答案 0 :(得分:0)

没关系。我做了更多的研究后发现了答案。这就是我所做的

显示导航栏未折叠时应用填充

@media (min-width: 768px) {
    #my_account {
        padding-left: 60px;
    }
}