Bootstrap 3 Navbar Collapse

后端 未结 12 2068
长发绾君心
长发绾君心 2020-11-22 09:27

Is there any way to increase the point at which the bootstrap 3 navbar collapses (i.e. so that it collapses into a drop down on portrait tablets)?

These two were app

12条回答
  •  逝去的感伤
    2020-11-22 09:59

    I am concerned about maintenance and upgrade problems down the road from customizing Bootstrap. I can document the customization steps today and hope that the person upgrading Bootstrap three years from now will find the documentation and reapply the steps (that may or may not work at that point). An argument can be made either way, I suppose, but I prefer keeping any customizations in my code.

    I don't quite understand how Seb33300's approach can work, though. It certainly did not work with Bootstrap 4.0.3. For the nav bar to expand at 1200 instead of 768, rules for both media queries must be overridden to prevent expanding at 768 and force expanding at 1200.

    I have a longer menu that would wrap on the iPad in Portrait mode. The following keeps the menu collapsed until the 1200 breakpoint:

    @media (min-width: 768px) {
        .navbar-header {
            float: none; }
        .navbar-toggle {
            display: block; }
        .navbar-fixed-top .navbar-collapse, 
        .navbar-static-top .navbar-collapse, 
        .navbar-fixed-bottom .navbar-collapse {
            padding-right: 15px;
            padding-left: 15px; }
        .navbar-collapse.collapse {
            display: none !important; }
            .navbar-collapse.collapse.in { 
            display: block!important; 
            margin-top: 0px; }
    }
    @media (min-width: 1200px) {
        .navbar-header {
            float: left; }
        .navbar-toggle {
        display: none; }
        .navbar-fixed-top .navbar-collapse, 
        .navbar-static-top .navbar-collapse, 
        .navbar-fixed-bottom .navbar-collapse {
            display: block !important; }
    }
    

提交回复
热议问题