From c11f41ba04791a0c408071527994dfb22c91a436 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Fri, 21 Dec 2012 00:50:28 -0800 Subject: [PATCH] flatten buttons and forms --- docs/assets/css/bootstrap.css | 220 ++++------------------- docs/components.html | 8 +- docs/templates/pages/components.mustache | 8 +- less/button-groups.less | 42 ++--- less/buttons.less | 23 ++- less/forms.less | 5 +- less/navbar.less | 6 +- 7 files changed, 74 insertions(+), 238 deletions(-) diff --git a/docs/assets/css/bootstrap.css b/docs/assets/css/bootstrap.css index 44581d473c..f186dd7369 100644 --- a/docs/assets/css/bootstrap.css +++ b/docs/assets/css/bootstrap.css @@ -847,8 +847,6 @@ input[type="color"], background-color: #ffffff; border: 1px solid #cccccc; border-radius: 4px; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; @@ -900,8 +898,8 @@ input[type="color"]:focus, outline: thin dotted \9; /* IE6-9 */ - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); + -webkit-box-shadow: 0 0 8px rgba(82, 168, 236, 0.6); + box-shadow: 0 0 8px rgba(82, 168, 236, 0.6); } input[type="radio"], @@ -2576,17 +2574,16 @@ button.close { .btn { display: inline-block; - padding: 6px 13px; + padding: 7px 13px; margin-bottom: 0; font-size: 14px; + font-weight: bold; line-height: 20px; text-align: center; vertical-align: middle; cursor: pointer; - border: 1px solid #ccc; + border: 0; border-radius: 4px; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); } .btn:focus { @@ -2670,153 +2667,24 @@ input[type="button"].btn-block { } .btn { - color: #555555; - text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75); - background-color: #eaeaea; - background-image: -moz-linear-gradient(top, #ffffff, #eaeaea); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#eaeaea)); - background-image: -webkit-linear-gradient(top, #ffffff, #eaeaea); - background-image: -o-linear-gradient(top, #ffffff, #eaeaea); - background-image: linear-gradient(to bottom, #ffffff, #eaeaea); - background-repeat: repeat-x; - border-color: #d7d7d7; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffeaeaea', GradientType=0); -} - -.btn:hover, -.btn:active, -.btn.active { - color: #555555; - background-color: #eaeaea; - background-position: 0 -15px; -} - -.btn:active, -.btn.active, -.btn[disabled], -.btn.disabled, -fieldset[disabled] .btn { - background-image: none; + color: #fff; + background-color: #ccc; } .btn-primary { - color: #ffffff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); - background-color: #006699; - background-image: -moz-linear-gradient(top, #0088cc, #006699); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#006699)); - background-image: -webkit-linear-gradient(top, #0088cc, #006699); - background-image: -o-linear-gradient(top, #0088cc, #006699); - background-image: linear-gradient(to bottom, #0088cc, #006699); - background-repeat: repeat-x; - border-color: #004c73; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff006699', GradientType=0); -} - -.btn-primary:hover, -.btn-primary:active, -.btn-primary.active { - color: #ffffff; - background-color: #006699; - background-position: 0 -15px; -} - -.btn-primary:active, -.btn-primary.active, -.btn-primary[disabled], -.btn-primary.disabled, -fieldset[disabled] .btn-primary { - background-image: none; + background-color: #0088cc; } .btn-warning { - color: #ffffff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); - background-color: #f89406; - background-image: -moz-linear-gradient(top, #fbb450, #f89406); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406)); - background-image: -webkit-linear-gradient(top, #fbb450, #f89406); - background-image: -o-linear-gradient(top, #fbb450, #f89406); - background-image: linear-gradient(to bottom, #fbb450, #f89406); - background-repeat: repeat-x; - border-color: #d37e05; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0); -} - -.btn-warning:hover, -.btn-warning:active, -.btn-warning.active { - color: #ffffff; - background-color: #f89406; - background-position: 0 -15px; -} - -.btn-warning:active, -.btn-warning.active, -.btn-warning[disabled], -.btn-warning.disabled, -fieldset[disabled] .btn-warning { - background-image: none; + background-color: #fbb450; } .btn-danger { - color: #ffffff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); - background-color: #bd362f; - background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f)); - background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f); - background-image: -o-linear-gradient(top, #ee5f5b, #bd362f); - background-image: linear-gradient(to bottom, #ee5f5b, #bd362f); - background-repeat: repeat-x; - border-color: #9e2d27; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0); -} - -.btn-danger:hover, -.btn-danger:active, -.btn-danger.active { - color: #ffffff; - background-color: #bd362f; - background-position: 0 -15px; -} - -.btn-danger:active, -.btn-danger.active, -.btn-danger[disabled], -.btn-danger.disabled, -fieldset[disabled] .btn-danger { - background-image: none; + background-color: #ee5f5b; } .btn-success { - color: #ffffff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); - background-color: #51a351; - background-image: -moz-linear-gradient(top, #62c462, #51a351); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351)); - background-image: -webkit-linear-gradient(top, #62c462, #51a351); - background-image: -o-linear-gradient(top, #62c462, #51a351); - background-image: linear-gradient(to bottom, #62c462, #51a351); - background-repeat: repeat-x; - border-color: #448944; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff51a351', GradientType=0); -} - -.btn-success:hover, -.btn-success:active, -.btn-success.active { - color: #ffffff; - background-color: #51a351; - background-position: 0 -15px; -} - -.btn-success:active, -.btn-success.active, -.btn-success[disabled], -.btn-success.disabled, -fieldset[disabled] .btn-success { - background-image: none; + background-color: #62c462; } .btn-link, @@ -2851,24 +2719,31 @@ fieldset[disabled] .btn-link:hover { .btn-group { position: relative; display: inline-block; - font-size: 0; - white-space: nowrap; vertical-align: middle; } -.btn-group + .btn-group { - margin-left: 5px; +.btn-group > .btn { + float: left; } -.btn-toolbar { - margin-top: 10px; - margin-bottom: 10px; - font-size: 0; +.btn-toolbar:before, +.btn-toolbar:after { + display: table; + content: " "; +} + +.btn-toolbar:after { + clear: both; +} + +.btn-toolbar .btn-group { + float: left; } .btn-toolbar > .btn + .btn, .btn-toolbar > .btn-group + .btn, -.btn-toolbar > .btn + .btn-group { +.btn-toolbar > .btn + .btn-group, +.btn-toolbar > .btn-group + .btn-group { margin-left: 5px; } @@ -2878,13 +2753,7 @@ fieldset[disabled] .btn-link:hover { } .btn-group > .btn + .btn { - margin-left: -1px; -} - -.btn-group > .btn, -.btn-group > .dropdown-menu, -.btn-group > .popover { - font-size: 14px; + margin-left: 1px; } .btn-group > .btn-mini { @@ -2923,13 +2792,6 @@ fieldset[disabled] .btn-link:hover { border-bottom-right-radius: 6px; } -.btn-group > .btn:hover, -.btn-group > .btn:focus, -.btn-group > .btn:active, -.btn-group > .btn.active { - z-index: 2; -} - .btn-group .dropdown-toggle:active, .btn-group.open .dropdown-toggle { outline: 0; @@ -2938,8 +2800,6 @@ fieldset[disabled] .btn-link:hover { .btn-group > .btn + .dropdown-toggle { padding-right: 8px; padding-left: 8px; - -webkit-box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); - box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); } .btn-group > .btn-mini + .dropdown-toggle { @@ -2954,8 +2814,8 @@ fieldset[disabled] .btn-link:hover { .btn-group.open .dropdown-toggle { background-image: none; - -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); - box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); + -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15); + box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15); } .btn-group.open .btn.dropdown-toggle { @@ -3012,10 +2872,6 @@ fieldset[disabled] .btn-link:hover { border-bottom-color: #fff; } -.btn-group-vertical { - display: inline-block; -} - .btn-group-vertical > .btn { display: block; float: none; @@ -3024,7 +2880,7 @@ fieldset[disabled] .btn-link:hover { } .btn-group-vertical > .btn + .btn { - margin-top: -1px; + margin-top: 1px; margin-left: 0; } @@ -3369,15 +3225,8 @@ fieldset[disabled] .btn-link:hover { margin-bottom: 20px; overflow: visible; background-color: #f2f2f2; - background-image: -moz-linear-gradient(top, #ffffff, #f2f2f2); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f2f2f2)); - background-image: -webkit-linear-gradient(top, #ffffff, #f2f2f2); - background-image: -o-linear-gradient(top, #ffffff, #f2f2f2); - background-image: linear-gradient(to bottom, #ffffff, #f2f2f2); - background-repeat: repeat-x; border: 1px solid #d4d4d4; border-radius: 4px; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff2f2f2', GradientType=0); -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); } @@ -3743,14 +3592,7 @@ fieldset[disabled] .navbar .btn-navbar { .navbar-inverse { background-color: #111111; - background-image: -moz-linear-gradient(top, #222222, #111111); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#222222), to(#111111)); - background-image: -webkit-linear-gradient(top, #222222, #111111); - background-image: -o-linear-gradient(top, #222222, #111111); - background-image: linear-gradient(to bottom, #222222, #111111); - background-repeat: repeat-x; border-color: #111111; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff111111', GradientType=0); } .navbar-inverse .brand, diff --git a/docs/components.html b/docs/components.html index ac9dc91ce2..4f49688f5e 100644 --- a/docs/components.html +++ b/docs/components.html @@ -223,10 +223,10 @@

Make a set of buttons appear vertically stacked rather than horizontally.

- - - - + + + +
diff --git a/docs/templates/pages/components.mustache b/docs/templates/pages/components.mustache
index 4db9d84dce..44d86f8a72 100644
--- a/docs/templates/pages/components.mustache
+++ b/docs/templates/pages/components.mustache
@@ -155,10 +155,10 @@
           

Make a set of buttons appear vertically stacked rather than horizontally.

- - - - + + + +
diff --git a/less/button-groups.less b/less/button-groups.less
index 04f3e5d72a..7113b583cb 100644
--- a/less/button-groups.less
+++ b/less/button-groups.less
@@ -7,24 +7,23 @@
 .btn-group {
   position: relative;
   display: inline-block;
-  font-size: 0; // remove as part 1 of font-size inline-block hack
   vertical-align: middle; // match .btn alignment given font-size hack above
-  white-space: nowrap; // prevent buttons from wrapping when in tight spaces (e.g., the table on the tests page)
-}
-
-// Space out series of button groups
-.btn-group + .btn-group {
-  margin-left: 5px;
+  > .btn {
+    float: left;
+  }
 }
 
 // Optional: Group multiple button groups together for a toolbar
 .btn-toolbar {
-  font-size: 0; // Hack to remove whitespace that results from using inline-block
-  margin-top: @line-height-base / 2;
-  margin-bottom: @line-height-base / 2;
+  .clearfix();
+  .btn-group {
+    float: left;
+  }
+  // Space out series of button groups
   > .btn + .btn,
   > .btn-group + .btn,
-  > .btn + .btn-group {
+  > .btn + .btn-group,
+  > .btn-group + .btn-group {
     margin-left: 5px;
   }
 }
@@ -35,12 +34,7 @@
   border-radius: 0;
 }
 .btn-group > .btn + .btn {
-  margin-left: -1px;
-}
-.btn-group > .btn,
-.btn-group > .dropdown-menu,
-.btn-group > .popover {
-  font-size: @font-size-base; // redeclare as part 2 of font-size inline-block hack
+  margin-left: 1px;
 }
 
 // Reset fonts for other sizes
@@ -78,14 +72,6 @@
   border-bottom-right-radius: @border-radius-large;
 }
 
-// On hover/focus/active, bring the proper btn to front
-.btn-group > .btn:hover,
-.btn-group > .btn:focus,
-.btn-group > .btn:active,
-.btn-group > .btn.active {
-  z-index: 2;
-}
-
 // On active and open, don't show outline
 .btn-group .dropdown-toggle:active,
 .btn-group.open .dropdown-toggle {
@@ -101,7 +87,6 @@
 .btn-group > .btn + .dropdown-toggle {
   padding-left: 8px;
   padding-right: 8px;
-  .box-shadow(~"inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)");
 }
 .btn-group > .btn-mini + .dropdown-toggle {
   padding-left: 5px;
@@ -118,7 +103,7 @@
   // Remove the gradient and set the same inset shadow as the :active state
   .dropdown-toggle {
     background-image: none;
-    .box-shadow(~"inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05)");
+    .box-shadow(inset 0 2px 4px rgba(0,0,0,.15));
   }
 
   // Keep the hover's background when dropdown is open
@@ -184,7 +169,6 @@
 // ----------------------
 
 .btn-group-vertical {
-  display: inline-block; // Make buttons only take up the width they need
 }
 .btn-group-vertical > .btn {
   display: block;
@@ -194,7 +178,7 @@
 }
 .btn-group-vertical > .btn + .btn {
   margin-left: 0;
-  margin-top: -1px;
+  margin-top: 1px;
 }
 .btn-group-vertical .btn:first-child {
   border-radius: @border-radius-base @border-radius-base 0 0;
diff --git a/less/buttons.less b/less/buttons.less
index fe80fa44b9..b9ed8e3303 100644
--- a/less/buttons.less
+++ b/less/buttons.less
@@ -9,16 +9,17 @@
 // Core styles
 .btn {
   display: inline-block;
-  padding: 6px 13px;
+  padding: 7px 13px;
   margin-bottom: 0; // For input.btn
   font-size: @font-size-base;
+  font-weight: bold;
   line-height: @line-height-base;
   text-align: center;
   vertical-align: middle;
   cursor: pointer;
-  border: 1px solid #ccc;
+  border: 0;
   border-radius: @border-radius-base;
-  .box-shadow(inset 0 1px 0 rgba(255,255,255,.25));
+  //.box-shadow(inset 0 1px 0 rgba(255,255,255,.25));
 
   &:focus {
     .tab-focus();
@@ -114,23 +115,29 @@ input[type="button"] {
 // --------------------------------------------------
 
 .btn {
-  .buttonBackground(@btn-background, @btn-background-highlight, @gray, 0 1px 0 rgba(255,255,255,.75));
+  color: #fff;
+  background-color: #ccc;
+  //.buttonBackground(@btn-background, @btn-background-highlight, @gray, 0 1px 0 rgba(255,255,255,.75));
 }
 // Primary appears as blue
 .btn-primary {
-  .buttonBackground(@btn-background-primary, @btn-background-primary-highlight);
+  background-color: @btn-background-primary;
+  //.buttonBackground(@btn-background-primary, @btn-background-primary-highlight);
 }
 // Warning appears are orange
 .btn-warning {
-  .buttonBackground(@btn-background-warning, @btn-background-warning-highlight);
+  background-color: @btn-background-warning;
+  //.buttonBackground(@btn-background-warning, @btn-background-warning-highlight);
 }
 // Danger and error appear as red
 .btn-danger {
-  .buttonBackground(@btn-background-danger, @btn-background-danger-highlight);
+  background-color: @btn-background-danger;
+  //.buttonBackground(@btn-background-danger, @btn-background-danger-highlight);
 }
 // Success appears as green
 .btn-success {
-  .buttonBackground(@btn-background-success, @btn-background-success-highlight);
+  background-color: @btn-background-success;
+  //.buttonBackground(@btn-background-success, @btn-background-success-highlight);
 }
 
 
diff --git a/less/forms.less b/less/forms.less
index dc4e7ffd98..5ea1d3cf19 100644
--- a/less/forms.less
+++ b/less/forms.less
@@ -67,7 +67,7 @@ input[type="color"],
   background-color: @input-background;
   border: 1px solid @input-border;
   border-radius: @input-border-radius;
-  .box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
+  // .box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
   .transition(~"border linear .2s, box-shadow linear .2s");
 }
 
@@ -118,7 +118,8 @@ input[type="color"],
     border-color: rgba(82,168,236,.8);
     outline: 0;
     outline: thin dotted \9; /* IE6-9 */
-    .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)");
+    //.box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)");
+    .box-shadow(0 0 8px rgba(82,168,236,.6));
   }
 }
 
diff --git a/less/navbar.less b/less/navbar.less
index 943400dfbb..4abd17ab7a 100644
--- a/less/navbar.less
+++ b/less/navbar.less
@@ -11,7 +11,8 @@
   overflow: visible;
   padding: 0 20px;
   margin-bottom: @line-height-base;
-  #gradient > .vertical(@navbar-background-highlight, @navbar-background);
+  background-color: @navbar-background;
+  //#gradient > .vertical(@navbar-background-highlight, @navbar-background);
   border: 1px solid @navbar-border;
   border-radius: @border-radius-base;
   .box-shadow(0 1px 4px rgba(0,0,0,.065));
@@ -362,7 +363,8 @@
 // -------------------------
 
 .navbar-inverse {
-  #gradient > .vertical(@navbar-inverse-background-highlight, @navbar-inverse-background);
+  background-color: @navbar-inverse-background;
+  //#gradient > .vertical(@navbar-inverse-background-highlight, @navbar-inverse-background);
   border-color: @navbar-inverse-border;
 
   .brand,