1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-26 06:44:35 +02:00

flatten buttons and forms

This commit is contained in:
Mark Otto
2012-12-21 00:50:28 -08:00
parent 7c04d573d0
commit c11f41ba04
7 changed files with 74 additions and 238 deletions

View File

@@ -847,8 +847,6 @@ input[type="color"],
background-color: #ffffff; background-color: #ffffff;
border: 1px solid #cccccc; border: 1px solid #cccccc;
border-radius: 4px; 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; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
@@ -900,8 +898,8 @@ input[type="color"]:focus,
outline: thin dotted \9; outline: thin dotted \9;
/* IE6-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); -webkit-box-shadow: 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); box-shadow: 0 0 8px rgba(82, 168, 236, 0.6);
} }
input[type="radio"], input[type="radio"],
@@ -2576,17 +2574,16 @@ button.close {
.btn { .btn {
display: inline-block; display: inline-block;
padding: 6px 13px; padding: 7px 13px;
margin-bottom: 0; margin-bottom: 0;
font-size: 14px; font-size: 14px;
font-weight: bold;
line-height: 20px; line-height: 20px;
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
cursor: pointer; cursor: pointer;
border: 1px solid #ccc; border: 0;
border-radius: 4px; 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 { .btn:focus {
@@ -2670,153 +2667,24 @@ input[type="button"].btn-block {
} }
.btn { .btn {
color: #555555; color: #fff;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75); background-color: #ccc;
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;
} }
.btn-primary { .btn-primary {
color: #ffffff; background-color: #0088cc;
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;
} }
.btn-warning { .btn-warning {
color: #ffffff; background-color: #fbb450;
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;
} }
.btn-danger { .btn-danger {
color: #ffffff; background-color: #ee5f5b;
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;
} }
.btn-success { .btn-success {
color: #ffffff; background-color: #62c462;
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;
} }
.btn-link, .btn-link,
@@ -2851,24 +2719,31 @@ fieldset[disabled] .btn-link:hover {
.btn-group { .btn-group {
position: relative; position: relative;
display: inline-block; display: inline-block;
font-size: 0;
white-space: nowrap;
vertical-align: middle; vertical-align: middle;
} }
.btn-group + .btn-group { .btn-group > .btn {
margin-left: 5px; float: left;
} }
.btn-toolbar { .btn-toolbar:before,
margin-top: 10px; .btn-toolbar:after {
margin-bottom: 10px; display: table;
font-size: 0; content: " ";
}
.btn-toolbar:after {
clear: both;
}
.btn-toolbar .btn-group {
float: left;
} }
.btn-toolbar > .btn + .btn, .btn-toolbar > .btn + .btn,
.btn-toolbar > .btn-group + .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; margin-left: 5px;
} }
@@ -2878,13 +2753,7 @@ fieldset[disabled] .btn-link:hover {
} }
.btn-group > .btn + .btn { .btn-group > .btn + .btn {
margin-left: -1px; margin-left: 1px;
}
.btn-group > .btn,
.btn-group > .dropdown-menu,
.btn-group > .popover {
font-size: 14px;
} }
.btn-group > .btn-mini { .btn-group > .btn-mini {
@@ -2923,13 +2792,6 @@ fieldset[disabled] .btn-link:hover {
border-bottom-right-radius: 6px; 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 .dropdown-toggle:active,
.btn-group.open .dropdown-toggle { .btn-group.open .dropdown-toggle {
outline: 0; outline: 0;
@@ -2938,8 +2800,6 @@ fieldset[disabled] .btn-link:hover {
.btn-group > .btn + .dropdown-toggle { .btn-group > .btn + .dropdown-toggle {
padding-right: 8px; padding-right: 8px;
padding-left: 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 { .btn-group > .btn-mini + .dropdown-toggle {
@@ -2954,8 +2814,8 @@ fieldset[disabled] .btn-link:hover {
.btn-group.open .dropdown-toggle { .btn-group.open .dropdown-toggle {
background-image: none; 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); -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), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
} }
.btn-group.open .btn.dropdown-toggle { .btn-group.open .btn.dropdown-toggle {
@@ -3012,10 +2872,6 @@ fieldset[disabled] .btn-link:hover {
border-bottom-color: #fff; border-bottom-color: #fff;
} }
.btn-group-vertical {
display: inline-block;
}
.btn-group-vertical > .btn { .btn-group-vertical > .btn {
display: block; display: block;
float: none; float: none;
@@ -3024,7 +2880,7 @@ fieldset[disabled] .btn-link:hover {
} }
.btn-group-vertical > .btn + .btn { .btn-group-vertical > .btn + .btn {
margin-top: -1px; margin-top: 1px;
margin-left: 0; margin-left: 0;
} }
@@ -3369,15 +3225,8 @@ fieldset[disabled] .btn-link:hover {
margin-bottom: 20px; margin-bottom: 20px;
overflow: visible; overflow: visible;
background-color: #f2f2f2; 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: 1px solid #d4d4d4;
border-radius: 4px; 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); -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
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 { .navbar-inverse {
background-color: #111111; 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; border-color: #111111;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff111111', GradientType=0);
} }
.navbar-inverse .brand, .navbar-inverse .brand,

View File

@@ -223,10 +223,10 @@
<p>Make a set of buttons appear vertically stacked rather than horizontally.</p> <p>Make a set of buttons appear vertically stacked rather than horizontally.</p>
<div class="bs-docs-example"> <div class="bs-docs-example">
<div class="btn-group btn-group-vertical"> <div class="btn-group btn-group-vertical">
<button type="button" class="btn"><i class="icon-align-left"></i></button> <button type="button" class="btn"><i class="glyphicon-align-left"></i></button>
<button type="button" class="btn"><i class="icon-align-center"></i></button> <button type="button" class="btn"><i class="glyphicon-align-center"></i></button>
<button type="button" class="btn"><i class="icon-align-right"></i></button> <button type="button" class="btn"><i class="glyphicon-align-right"></i></button>
<button type="button" class="btn"><i class="icon-align-justify"></i></button> <button type="button" class="btn"><i class="glyphicon-align-justify"></i></button>
</div> </div>
</div> </div>
<pre class="prettyprint linenums"> <pre class="prettyprint linenums">

View File

@@ -155,10 +155,10 @@
<p>Make a set of buttons appear vertically stacked rather than horizontally.</p> <p>Make a set of buttons appear vertically stacked rather than horizontally.</p>
<div class="bs-docs-example"> <div class="bs-docs-example">
<div class="btn-group btn-group-vertical"> <div class="btn-group btn-group-vertical">
<button type="button" class="btn"><i class="icon-align-left"></i></button> <button type="button" class="btn"><i class="glyphicon-align-left"></i></button>
<button type="button" class="btn"><i class="icon-align-center"></i></button> <button type="button" class="btn"><i class="glyphicon-align-center"></i></button>
<button type="button" class="btn"><i class="icon-align-right"></i></button> <button type="button" class="btn"><i class="glyphicon-align-right"></i></button>
<button type="button" class="btn"><i class="icon-align-justify"></i></button> <button type="button" class="btn"><i class="glyphicon-align-justify"></i></button>
</div> </div>
</div> </div>
<pre class="prettyprint linenums"> <pre class="prettyprint linenums">

View File

@@ -7,24 +7,23 @@
.btn-group { .btn-group {
position: relative; position: relative;
display: inline-block; 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 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) > .btn {
} float: left;
}
// Space out series of button groups
.btn-group + .btn-group {
margin-left: 5px;
} }
// Optional: Group multiple button groups together for a toolbar // Optional: Group multiple button groups together for a toolbar
.btn-toolbar { .btn-toolbar {
font-size: 0; // Hack to remove whitespace that results from using inline-block .clearfix();
margin-top: @line-height-base / 2; .btn-group {
margin-bottom: @line-height-base / 2; float: left;
}
// Space out series of button groups
> .btn + .btn, > .btn + .btn,
> .btn-group + .btn, > .btn-group + .btn,
> .btn + .btn-group { > .btn + .btn-group,
> .btn-group + .btn-group {
margin-left: 5px; margin-left: 5px;
} }
} }
@@ -35,12 +34,7 @@
border-radius: 0; border-radius: 0;
} }
.btn-group > .btn + .btn { .btn-group > .btn + .btn {
margin-left: -1px; 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
} }
// Reset fonts for other sizes // Reset fonts for other sizes
@@ -78,14 +72,6 @@
border-bottom-right-radius: @border-radius-large; 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 // On active and open, don't show outline
.btn-group .dropdown-toggle:active, .btn-group .dropdown-toggle:active,
.btn-group.open .dropdown-toggle { .btn-group.open .dropdown-toggle {
@@ -101,7 +87,6 @@
.btn-group > .btn + .dropdown-toggle { .btn-group > .btn + .dropdown-toggle {
padding-left: 8px; padding-left: 8px;
padding-right: 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 { .btn-group > .btn-mini + .dropdown-toggle {
padding-left: 5px; padding-left: 5px;
@@ -118,7 +103,7 @@
// Remove the gradient and set the same inset shadow as the :active state // Remove the gradient and set the same inset shadow as the :active state
.dropdown-toggle { .dropdown-toggle {
background-image: none; 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 // Keep the hover's background when dropdown is open
@@ -184,7 +169,6 @@
// ---------------------- // ----------------------
.btn-group-vertical { .btn-group-vertical {
display: inline-block; // Make buttons only take up the width they need
} }
.btn-group-vertical > .btn { .btn-group-vertical > .btn {
display: block; display: block;
@@ -194,7 +178,7 @@
} }
.btn-group-vertical > .btn + .btn { .btn-group-vertical > .btn + .btn {
margin-left: 0; margin-left: 0;
margin-top: -1px; margin-top: 1px;
} }
.btn-group-vertical .btn:first-child { .btn-group-vertical .btn:first-child {
border-radius: @border-radius-base @border-radius-base 0 0; border-radius: @border-radius-base @border-radius-base 0 0;

View File

@@ -9,16 +9,17 @@
// Core styles // Core styles
.btn { .btn {
display: inline-block; display: inline-block;
padding: 6px 13px; padding: 7px 13px;
margin-bottom: 0; // For input.btn margin-bottom: 0; // For input.btn
font-size: @font-size-base; font-size: @font-size-base;
font-weight: bold;
line-height: @line-height-base; line-height: @line-height-base;
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
cursor: pointer; cursor: pointer;
border: 1px solid #ccc; border: 0;
border-radius: @border-radius-base; 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 { &:focus {
.tab-focus(); .tab-focus();
@@ -114,23 +115,29 @@ input[type="button"] {
// -------------------------------------------------- // --------------------------------------------------
.btn { .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 // Primary appears as blue
.btn-primary { .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 // Warning appears are orange
.btn-warning { .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 // Danger and error appear as red
.btn-danger { .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 // Success appears as green
.btn-success { .btn-success {
.buttonBackground(@btn-background-success, @btn-background-success-highlight); background-color: @btn-background-success;
//.buttonBackground(@btn-background-success, @btn-background-success-highlight);
} }

View File

@@ -67,7 +67,7 @@ input[type="color"],
background-color: @input-background; background-color: @input-background;
border: 1px solid @input-border; border: 1px solid @input-border;
border-radius: @input-border-radius; 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"); .transition(~"border linear .2s, box-shadow linear .2s");
} }
@@ -118,7 +118,8 @@ input[type="color"],
border-color: rgba(82,168,236,.8); border-color: rgba(82,168,236,.8);
outline: 0; outline: 0;
outline: thin dotted \9; /* IE6-9 */ 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));
} }
} }

View File

@@ -11,7 +11,8 @@
overflow: visible; overflow: visible;
padding: 0 20px; padding: 0 20px;
margin-bottom: @line-height-base; 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: 1px solid @navbar-border;
border-radius: @border-radius-base; border-radius: @border-radius-base;
.box-shadow(0 1px 4px rgba(0,0,0,.065)); .box-shadow(0 1px 4px rgba(0,0,0,.065));
@@ -362,7 +363,8 @@
// ------------------------- // -------------------------
.navbar-inverse { .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; border-color: @navbar-inverse-border;
.brand, .brand,