mirror of
https://github.com/twbs/bootstrap.git
synced 2025-04-06 23:57:36 +02:00
Removes filters as a way to provide gradients for IE<=9
- Lets us use rounded corners in IE9 - Makes hover / active states work correctly in IE<=9 Only change for non-IE is that moving from hover -> not hovering no longer animates (was a subtle blend) due to mismatch between the bottom of the gradient and the background color. Refactor: moves the primary button background to match the others.
This commit is contained in:
parent
0ef4b6419f
commit
29f0e4c28b
@ -468,11 +468,6 @@
|
|||||||
<td><code>@opacity: 100</code></td>
|
<td><code>@opacity: 100</code></td>
|
||||||
<td>Set, in whole numbers, the opacity percentage (e.g., "50" or "75")</td>
|
<td>Set, in whole numbers, the opacity percentage (e.g., "50" or "75")</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td><code>.reset-filter()</code></td>
|
|
||||||
<td><em class="muted">none</em></td>
|
|
||||||
<td>Resets any IE filter</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<h3>Forms</h3>
|
<h3>Forms</h3>
|
||||||
|
5
docs/templates/pages/less.mustache
vendored
5
docs/templates/pages/less.mustache
vendored
@ -403,11 +403,6 @@
|
|||||||
<td><code>@opacity: 100</code></td>
|
<td><code>@opacity: 100</code></td>
|
||||||
<td>{{_i}}Set, in whole numbers, the opacity percentage (e.g., "50" or "75"){{/i}}</td>
|
<td>{{_i}}Set, in whole numbers, the opacity percentage (e.g., "50" or "75"){{/i}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td><code>.reset-filter()</code></td>
|
|
||||||
<td><em class="muted">none</em></td>
|
|
||||||
<td>{{_i}}Resets any IE filter{{/i}}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<h3>Forms</h3>
|
<h3>Forms</h3>
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
// BUTTON STYLES
|
// BUTTON STYLES
|
||||||
// -------------
|
// -------------
|
||||||
|
|
||||||
// Shared colors for buttons and alerts
|
|
||||||
.btn {
|
.btn {
|
||||||
// Set text color
|
// Set text color
|
||||||
|
&.primary,
|
||||||
|
&.primary:hover,
|
||||||
&.danger,
|
&.danger,
|
||||||
&.danger:hover,
|
&.danger:hover,
|
||||||
&.success,
|
&.success,
|
||||||
@ -13,17 +14,36 @@
|
|||||||
text-shadow: 0 -1px 0 rgba(0,0,0,.25);
|
text-shadow: 0 -1px 0 rgba(0,0,0,.25);
|
||||||
color: @white
|
color: @white
|
||||||
}
|
}
|
||||||
|
&.primary {
|
||||||
|
.buttonBackground(@primaryButtonBackground, spin(@primaryButtonBackground, 15));
|
||||||
|
}
|
||||||
// Danger and error appear as red
|
// Danger and error appear as red
|
||||||
&.danger {
|
&.danger {
|
||||||
.gradientBar(#ee5f5b, #c43c35);
|
.buttonBackground(#ee5f5b, #c43c35);
|
||||||
}
|
}
|
||||||
// Success appears as green
|
// Success appears as green
|
||||||
&.success {
|
&.success {
|
||||||
.gradientBar(#62c462, #57a957);
|
.buttonBackground(#62c462, #57a957);
|
||||||
}
|
}
|
||||||
// Info appears as a neutral blue
|
// Info appears as a neutral blue
|
||||||
&.info {
|
&.info {
|
||||||
.gradientBar(#5bc0de, #339bb9);
|
.buttonBackground(#5bc0de, #339bb9);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttonBackground(@startColor, @endColor) {
|
||||||
|
// gradientBar will set the background to a pleasing blend of these, to support IE<=9
|
||||||
|
.gradientBar(@startColor, @endColor);
|
||||||
|
|
||||||
|
// in these cases the gradient won't cover the background, so we override
|
||||||
|
&:hover, &:active, &.active {
|
||||||
|
background-color: @endColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active,
|
||||||
|
&.active {
|
||||||
|
// IE 7 + 8 can't handle box-shadow to show active, so we darken a bit ourselves
|
||||||
|
background-color: darken(@endColor, 10%) e("\9");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +67,12 @@
|
|||||||
&:hover {
|
&:hover {
|
||||||
color: @grayDark;
|
color: @grayDark;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
background-color: darken(@white, 10%);
|
||||||
background-position: 0 -15px;
|
background-position: 0 -15px;
|
||||||
|
|
||||||
|
// transition is only when going to hover, otherwise the background
|
||||||
|
// behind the gradient (there for IE<=9 fallback) gets mismatched
|
||||||
|
.transition(background-position .1s linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Focus state for keyboard and accessibility
|
// Focus state for keyboard and accessibility
|
||||||
@ -55,27 +80,18 @@
|
|||||||
outline: 1px dotted #666;
|
outline: 1px dotted #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Primary Button Type
|
|
||||||
&.primary {
|
|
||||||
color: @white;
|
|
||||||
text-shadow: 0 -1px 0 rgba(0,0,0,.25);
|
|
||||||
.gradientBar(@primaryButtonBackground, spin(@primaryButtonBackground, 15));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Transitions
|
|
||||||
.transition(.1s linear all);
|
|
||||||
|
|
||||||
// Active and Disabled states
|
// Active and Disabled states
|
||||||
&.active,
|
&.active,
|
||||||
&:active {
|
&:active {
|
||||||
background-image: none;
|
background-image: none;
|
||||||
@shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);
|
@shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);
|
||||||
.box-shadow(@shadow);
|
.box-shadow(@shadow);
|
||||||
|
background-color: darken(@white, 10%);
|
||||||
|
background-color: darken(@white, 15%) e("\9");
|
||||||
}
|
}
|
||||||
&.disabled {
|
&.disabled {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
background-image: none;
|
background-image: none;
|
||||||
.reset-filter();
|
|
||||||
.opacity(65);
|
.opacity(65);
|
||||||
.box-shadow(none);
|
.box-shadow(none);
|
||||||
}
|
}
|
||||||
@ -84,7 +100,6 @@
|
|||||||
// def because IE8 and below will drop it ;_;
|
// def because IE8 and below will drop it ;_;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
background-image: none;
|
background-image: none;
|
||||||
.reset-filter();
|
|
||||||
.opacity(65);
|
.opacity(65);
|
||||||
.box-shadow(none);
|
.box-shadow(none);
|
||||||
}
|
}
|
||||||
@ -101,10 +116,6 @@
|
|||||||
font-size: @baseFontSize - 2px;
|
font-size: @baseFontSize - 2px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Super jank hack for removing border-radius from IE9 so we can keep filter gradients on alerts and buttons
|
|
||||||
:root .btn {
|
|
||||||
border-radius: 0 \0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Help Firefox not be a jerk about adding extra padding to buttons
|
// Help Firefox not be a jerk about adding extra padding to buttons
|
||||||
button.btn,
|
button.btn,
|
||||||
@ -113,4 +124,4 @@ input[type=submit].btn {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,10 +266,9 @@
|
|||||||
background-image: -o-linear-gradient(left, @startColor, @endColor); // Opera 11.10
|
background-image: -o-linear-gradient(left, @startColor, @endColor); // Opera 11.10
|
||||||
background-image: linear-gradient(left, @startColor, @endColor); // Le standard
|
background-image: linear-gradient(left, @startColor, @endColor); // Le standard
|
||||||
background-repeat: repeat-x;
|
background-repeat: repeat-x;
|
||||||
filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@startColor,@endColor)); // IE9 and down
|
|
||||||
}
|
}
|
||||||
.vertical(@startColor: #555, @endColor: #333) {
|
.vertical(@startColor: #555, @endColor: #333) {
|
||||||
background-color: @endColor;
|
background-color: mix(@startColor, @endColor, 60%);
|
||||||
background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+
|
background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+
|
||||||
background-image: -ms-linear-gradient(top, @startColor, @endColor); // IE10
|
background-image: -ms-linear-gradient(top, @startColor, @endColor); // IE10
|
||||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+
|
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+
|
||||||
@ -277,7 +276,6 @@
|
|||||||
background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10
|
background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10
|
||||||
background-image: linear-gradient(top, @startColor, @endColor); // The standard
|
background-image: linear-gradient(top, @startColor, @endColor); // The standard
|
||||||
background-repeat: repeat-x;
|
background-repeat: repeat-x;
|
||||||
filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); // IE9 and down
|
|
||||||
}
|
}
|
||||||
.directional(@startColor: #555, @endColor: #333, @deg: 45deg) {
|
.directional(@startColor: #555, @endColor: #333, @deg: 45deg) {
|
||||||
background-color: @endColor;
|
background-color: @endColor;
|
||||||
@ -289,7 +287,7 @@
|
|||||||
background-image: linear-gradient(@deg, @startColor, @endColor); // The standard
|
background-image: linear-gradient(@deg, @startColor, @endColor); // The standard
|
||||||
}
|
}
|
||||||
.vertical-three-colors(@startColor: #00b3ee, @midColor: #7a43b6, @colorStop: 50%, @endColor: #c3325f) {
|
.vertical-three-colors(@startColor: #00b3ee, @midColor: #7a43b6, @colorStop: 50%, @endColor: #c3325f) {
|
||||||
background-color: @endColor;
|
background-color: @midColor;
|
||||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), color-stop(@colorStop, @midColor), to(@endColor));
|
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), color-stop(@colorStop, @midColor), to(@endColor));
|
||||||
background-image: -webkit-linear-gradient(@startColor, @midColor @colorStop, @endColor);
|
background-image: -webkit-linear-gradient(@startColor, @midColor @colorStop, @endColor);
|
||||||
background-image: -moz-linear-gradient(top, @startColor, @midColor @colorStop, @endColor);
|
background-image: -moz-linear-gradient(top, @startColor, @midColor @colorStop, @endColor);
|
||||||
@ -297,7 +295,6 @@
|
|||||||
background-image: -o-linear-gradient(@startColor, @midColor @colorStop, @endColor);
|
background-image: -o-linear-gradient(@startColor, @midColor @colorStop, @endColor);
|
||||||
background-image: linear-gradient(@startColor, @midColor @colorStop, @endColor);
|
background-image: linear-gradient(@startColor, @midColor @colorStop, @endColor);
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); // IE9 and down, gets no color-stop at all for proper fallback
|
|
||||||
}
|
}
|
||||||
.radial(@innerColor: #555, @outerColor: #333) {
|
.radial(@innerColor: #555, @outerColor: #333) {
|
||||||
background-color: @outsideColor;
|
background-color: @outsideColor;
|
||||||
@ -319,11 +316,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset filters for IE
|
|
||||||
.reset-filter() {
|
|
||||||
filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// COMPONENT MIXINS
|
// COMPONENT MIXINS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user