]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Improve buttons in navbars
authorMark Otto <otto@github.com>
Fri, 3 May 2013 06:05:09 +0000 (23:05 -0700)
committerMark Otto <otto@github.com>
Fri, 3 May 2013 06:05:09 +0000 (23:05 -0700)
* Add top margin, calculated by subtracting height of an input from height of a navbar, and dividing by two
* Uses the same method as .navbar-form
* To use, add .navbar-btn to any button outside a form element
* Also add section to docs detailing buttons in navbars, and add more ids for the other unlinked and unmentioned sections in the side nav

docs/_includes/docs-nav.html
docs/docs.html
less/navbar.less

index c10bea4d3ede94a16ab80730a7e5b6da07698b60..ebeb0d82800409d547d579b1efbe69cfcd7f5e0c 100644 (file)
         <li><a href="#navbar-basic">Basic navbar</a></li>
         <li><a href="#navbar-nav">Nav links</a></li>
         <li><a href="#navbar-forms">Forms in navbars</a></li>
+        <li><a href="#navbar-buttons">Buttons in navbars</a></li>
+        <li><a href="#navbar-component-alignment">Component alignment</a></li>
+        <li><a href="#navbar-text">Text in navbars</a></li>
         <li><a href="#navbar-fixed-top">Fixed top navbar</a></li>
         <li><a href="#navbar-fixed-bottom">Fixed bottom navbar</a></li>
         <li><a href="#navbar-static-top">Static top navbar</a></li>
index 2b922b695d89985463a31586f481b7d5f1648dfc..e4f711381838008c3ae090d291d1107ba7be3b1c 100644 (file)
@@ -3522,13 +3522,19 @@ For example, <code>&lt;section&gt;</code> should be wrapped as inline.
 </form>
 {% endhighlight %}
 
-    <h3>Component alignment</h3>
-    <p>Align nav links, search form, or text, use the <code>.pull-left</code> or <code>.pull-right</code> utility classes. Both classes will add a CSS float in the specified direction.</p>
+    <h3 id="navbar-buttons">Buttons</h3>
+    <p>For buttons not residing in a <code>&lt;form&gt;</code>, add this class to vertically center buttons within a navbar.</p>
+    <div class="bs-docs-example">
+      <div class="navbar">
+        <a href="#" class="navbar-brand">Derp</a>
+        <button type="button" class="btn">Submit</button>
+      </div>
+    </div>
 
-    <h3>Using dropdowns</h3>
-    <p>Add dropdowns and dropups to the nav with a bit of markup and the <a href="./javascript.html#dropdowns">dropdowns JavaScript plugin</a>.</p>
+    <h3 id="navbar-component-alignment">Component alignment</h3>
+    <p>Align nav links, search form, or text, use the <code>.pull-left</code> or <code>.pull-right</code> utility classes. Both classes will add a CSS float in the specified direction.</p>
 
-    <h3>Text</h3>
+    <h3 id="navbar-text">Text</h3>
     <p>Wrap strings of text in an element with <code>.navbar-text</code>, usually on a <code>&lt;p&gt;</code> tag for proper leading and color.</p>
 
 
index 88cb33bce33c9e0ec51722cd5da8548bbb410b91..9511670cd5b9ca0bb9f547504e01e6d5a7f43826 100644 (file)
 
 }
 
+
+// Buttons in navbar
+//
+// Vertically center a button within a navbar (when *not* in a form).
+
+.navbar-btn {
+  margin-top: ((@navbar-height - @input-height-base) / 2);
+}
+
 /*
 
 // Janky solution for now to account for links outside the .nav
   }
 }
 
-// Buttons in navbar
-// -------------------------
-.navbar .btn,
-.navbar .btn-group {
-  .navbarVerticalAlign(30px); // Vertically center in navbar
-}
-.navbar .btn-group .btn,
-.navbar .input-prepend .btn,
-.navbar .input-append .btn {
-  margin-top: 0; // then undo the margin here so we don't accidentally double it
-}
-
-
 */