diff options
| author | Mark Otto <[email protected]> | 2012-01-27 16:26:55 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2012-01-27 16:26:55 -0800 |
| commit | f6dc566963c63d5113e72f0098ad9da2c414f33f (patch) | |
| tree | 91072cd92fe08910009474ee4a128983b3bb75b9 /less | |
| parent | 800d0b24e08dec4835e7f4126701428c5c5bae2c (diff) | |
| download | bootstrap-f6dc566963c63d5113e72f0098ad9da2c414f33f.tar.xz bootstrap-f6dc566963c63d5113e72f0098ad9da2c414f33f.zip | |
overhaul navbar behavior in responsive css
Diffstat (limited to 'less')
| -rw-r--r-- | less/navbar.less | 3 | ||||
| -rw-r--r-- | less/responsive.less | 173 |
2 files changed, 110 insertions, 66 deletions
diff --git a/less/navbar.less b/less/navbar.less index 602e26ae8..07e2bed8b 100644 --- a/less/navbar.less +++ b/less/navbar.less @@ -165,7 +165,8 @@ } // Active nav items -.navbar .nav .active > a { +.navbar .nav .active > a, +.navbar .nav .active > a:hover { color: @navbarLinkColorHover; text-decoration: none; background-color: @navbarBackground; diff --git a/less/responsive.less b/less/responsive.less index 917fdc3e2..8bfe705b4 100644 --- a/less/responsive.less +++ b/less/responsive.less @@ -15,7 +15,7 @@ // ------------------ // Hide from screenreaders and browsers -// Credit: HTML5BP +// Credit: HTML5 Boilerplate .hidden { display: none; visibility: hidden; @@ -27,62 +27,6 @@ @media (max-width: 480px) { - // Make the nav work for small devices - .navbar { - .nav { - position: absolute; - top: 0; - left: 0; - width: 180px; - padding-top: 40px; - list-style: none; - } - .nav, - .nav > li:last-child a { - .border-radius(0 0 4px 0); - } - .nav > li { - float: none; - display: none; - } - .nav > li > a { - float: none; - background-color: #222; - } - .nav > .active { - display: block; - position: absolute; - top: 0; - left: 0; - } - .nav > .active > a { - background-color: transparent; - } - .nav > .active > a:hover { - background-color: #333; - } - .nav > .active > a:after { - display: inline-block; - width: 0; - height: 0; - margin-top: 8px; - margin-left: 6px; - text-indent: -99999px; - vertical-align: top; - border-left: 4px solid transparent; - border-right: 4px solid transparent; - border-top: 4px solid @white; - .opacity(100); - content: "↓"; - } - .nav:hover > li { - display: block; - } - .nav:hover > li > a:hover { - background-color: #333; - } - } - // Remove the horizontal form styles .form-horizontal .control-group > label { float: none; @@ -124,15 +68,9 @@ // -------------------------------------------------- @media (max-width: 768px) { - - // Unfix the navbar - .navbar-fixed { - position: absolute; - } - .navbar-fixed .nav { - float: none; - } + // GRID & CONTAINERS + // ----------------- // Remove width from containers .container { width: auto; @@ -209,6 +147,111 @@ } + +// TABLETS AND BELOW +// ----------------- +@media (max-width: 940px) { + + // UNFIX THE TOPBAR + // ---------------- + // Remove any padding from the body + body { + padding-top: 0; + } + // Unfix the navbar + .navbar-fixed-top { + position: static; + margin-bottom: @baseLineHeight * 2; + } + .navbar-inner { + padding: 10px; + background-image: none; + } + .navbar .container { + padding: 0; + } + // Account for brand name + .navbar .brand { + float: none; + display: block; + padding-left: 15px; + padding-right: 15px; + margin: 0; + } + // Block-level the nav + .navbar .nav { + float: none; + margin: (@baseLineHeight / 2) 0; + } + .navbar .nav > li { + float: none; + } + .navbar .nav > li > a { + margin-bottom: 2px; + } + .navbar .nav > .vertical-divider { + display: none; + } + // Nav and dropdown links in navbar + .navbar .nav > li > a, + .navbar .dropdown-menu a { + padding: 6px 15px; + font-weight: bold; + color: @navbarLinkColor; + .border-radius(3px); + } + .navbar .dropdown-menu li + li a { + margin-bottom: 2px; + } + .navbar .nav > li > a:hover, + .navbar .dropdown-menu a:hover { + background-color: @navbarBackground; + } + // Dropdowns in the navbar + .navbar .dropdown-menu { + position: static; + display: block; + float: none; + max-width: none; + margin: 0 15px; + padding: 0; + background-color: transparent; + border: none; + .border-radius(0); + .box-shadow(none); + } + .navbar .dropdown-menu:before, + .navbar .dropdown-menu:after { + display: none; + } + .navbar .dropdown-menu .divider { + display: none; + } + // Forms in navbar + .navbar-form, + .navbar-search { + float: none; + padding: (@baseLineHeight / 2) 15px; + margin: (@baseLineHeight / 2) 0; + border-top: 1px solid @navbarBackground; + border-bottom: 1px solid @navbarBackground; + @shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1); + .box-shadow(@shadow); + } + // Pull right (secondary) nav content + .navbar .nav.pull-right { + float: none; + margin-left: 0; + } + // Static navbar + .navbar-static .navbar-inner { + padding-left: 10px; + padding-right: 10px; + } + +} + + // LARGE DESKTOP & UP // ------------------ /* |
