Created
April 19, 2012 08:07
-
-
Save hileon/2419540 to your computer and use it in GitHub Desktop.
standalone_btn_of_twitter_bootstrap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Stant alone button less file. Extracted from twitter's bootstrap | |
//Start bootstrap button | |
// Grays | |
// ------------------------- | |
@black: #000; | |
@grayDarker: #222; | |
@grayDark: #333; | |
@gray: #555; | |
@grayLight: #999; | |
@grayLighter: #eee; | |
@white: #fff; | |
// Accent colors | |
// ------------------------- | |
@blue: #049cdb; | |
@blueDark: #0064cd; | |
@green: #46a546; | |
@red: #9d261d; | |
@yellow: #ffc40d; | |
@orange: #f89406; | |
@pink: #c3325f; | |
@purple: #7a43b6; | |
// Links | |
// ------------------------- | |
@linkColor: #08c; | |
@linkColorHover: darken(@linkColor, 15%); | |
//Fonts | |
@baseFontSize: 13px; | |
@baseFontFamily: "Helvetica Neue", Helvetica, Arial, sans-serif; | |
@baseLineHeight: 18px; | |
@altFontFamily: Georgia, "Times New Roman", Times, serif; | |
// Buttons | |
// ------------------------- | |
@btnBackground: @white; | |
@btnBackgroundHighlight: darken(@white, 10%); | |
@btnBorder: darken(@white, 20%); | |
@btnPrimaryBackground: @linkColor; | |
@btnPrimaryBackgroundHighlight: spin(@btnPrimaryBackground, 15%); | |
@btnInfoBackground: #5bc0de; | |
@btnInfoBackgroundHighlight: #2f96b4; | |
@btnSuccessBackground: #62c462; | |
@btnSuccessBackgroundHighlight: #51a351; | |
@btnWarningBackground: lighten(@orange, 15%); | |
@btnWarningBackgroundHighlight: @orange; | |
@btnDangerBackground: #ee5f5b; | |
@btnDangerBackgroundHighlight: #bd362f; | |
@btnInverseBackground: @gray; | |
@btnInverseBackgroundHighlight: @grayDarker; | |
// Gradients | |
#gradient { | |
.horizontal(@startColor: #555, @endColor: #333) { | |
background-color: @endColor; | |
background-image: -moz-linear-gradient(left, @startColor, @endColor); // FF 3.6+ | |
background-image: -ms-linear-gradient(left, @startColor, @endColor); // IE10 | |
background-image: -webkit-gradient(linear, 0 0, 100% 0, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+ | |
background-image: -webkit-linear-gradient(left, @startColor, @endColor); // Safari 5.1+, Chrome 10+ | |
background-image: -o-linear-gradient(left, @startColor, @endColor); // Opera 11.10 | |
background-image: linear-gradient(left, @startColor, @endColor); // Le standard | |
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) { | |
background-color: mix(@startColor, @endColor, 60%); | |
background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+ | |
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-linear-gradient(top, @startColor, @endColor); // Safari 5.1+, Chrome 10+ | |
background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10 | |
background-image: linear-gradient(top, @startColor, @endColor); // The standard | |
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) { | |
background-color: @endColor; | |
background-repeat: repeat-x; | |
background-image: -moz-linear-gradient(@deg, @startColor, @endColor); // FF 3.6+ | |
background-image: -ms-linear-gradient(@deg, @startColor, @endColor); // IE10 | |
background-image: -webkit-linear-gradient(@deg, @startColor, @endColor); // Safari 5.1+, Chrome 10+ | |
background-image: -o-linear-gradient(@deg, @startColor, @endColor); // Opera 11.10 | |
background-image: linear-gradient(@deg, @startColor, @endColor); // The standard | |
} | |
.vertical-three-colors(@startColor: #00b3ee, @midColor: #7a43b6, @colorStop: 50%, @endColor: #c3325f) { | |
background-color: mix(@midColor, @endColor, 80%); | |
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: -moz-linear-gradient(top, @startColor, @midColor @colorStop, @endColor); | |
background-image: -ms-linear-gradient(@startColor, @midColor @colorStop, @endColor); | |
background-image: -o-linear-gradient(@startColor, @midColor @colorStop, @endColor); | |
background-image: linear-gradient(@startColor, @midColor @colorStop, @endColor); | |
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) { | |
background-color: @outerColor; | |
background-image: -webkit-gradient(radial, center center, 0, center center, 460, from(@innerColor), to(@outerColor)); | |
background-image: -webkit-radial-gradient(circle, @innerColor, @outerColor); | |
background-image: -moz-radial-gradient(circle, @innerColor, @outerColor); | |
background-image: -ms-radial-gradient(circle, @innerColor, @outerColor); | |
background-image: -o-radial-gradient(circle, @innerColor, @outerColor); | |
background-repeat: no-repeat; | |
} | |
.striped(@color, @angle: -45deg) { | |
background-color: @color; | |
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(.25, rgba(255,255,255,.15)), color-stop(.25, transparent), color-stop(.5, transparent), color-stop(.5, rgba(255,255,255,.15)), color-stop(.75, rgba(255,255,255,.15)), color-stop(.75, transparent), to(transparent)); | |
background-image: -webkit-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); | |
background-image: -moz-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); | |
background-image: -ms-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); | |
background-image: -o-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); | |
background-image: linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); | |
} | |
} | |
// Button backgrounds | |
// ------------------ | |
// Gradient Bar Colors for buttons and alerts | |
.gradientBar(@primaryColor, @secondaryColor) { | |
#gradient > .vertical(@primaryColor, @secondaryColor); | |
border-color: @secondaryColor @secondaryColor darken(@secondaryColor, 15%); | |
border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) fadein(rgba(0,0,0,.1), 15%); | |
} | |
.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, &.disabled, &[disabled] { | |
background-color: @endColor; | |
} | |
// IE 7 + 8 can't handle box-shadow to show active, so we darken a bit ourselves | |
&:active, | |
&.active { | |
background-color: darken(@endColor, 10%) e("\9"); | |
} | |
} | |
// Drop shadows | |
.box-shadow(@shadow: 0 1px 3px rgba(0,0,0,.25)) { | |
-webkit-box-shadow: @shadow; | |
-moz-box-shadow: @shadow; | |
box-shadow: @shadow; | |
} | |
// Transitions | |
.transition(@transition) { | |
-webkit-transition: @transition; | |
-moz-transition: @transition; | |
-ms-transition: @transition; | |
-o-transition: @transition; | |
transition: @transition; | |
} | |
// Core | |
.btn { | |
display: inline-block; | |
padding: 4px 10px 4px; | |
margin-bottom: 0; // For input.btn | |
font-size: @baseFontSize; | |
line-height: @baseLineHeight; | |
color: @grayDark; | |
text-align: center; | |
text-shadow: 0 1px 1px rgba(255,255,255,.75); | |
vertical-align: middle; | |
.buttonBackground(@btnBackground, @btnBackgroundHighlight); | |
border: 1px solid @btnBorder; | |
border-bottom-color: darken(@btnBorder, 10%); | |
.border-radius(4px); | |
@shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); | |
.box-shadow(@shadow); | |
cursor: pointer; | |
} | |
// Hover state | |
.btn:hover { | |
color: @grayDark; | |
text-decoration: none; | |
background-color: darken(@white, 10%); | |
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 | |
.btn:focus { | |
// Default | |
outline: thin dotted #333; | |
// Webkit | |
outline: 5px auto -webkit-focus-ring-color; | |
outline-offset: -2px; | |
} | |
// Large | |
.btn-large { | |
padding: 9px 14px; | |
font-size: @baseFontSize + 2px; | |
line-height: normal; | |
.border-radius(5px); | |
} | |
// Small | |
.btn-small { | |
padding: 5px 9px; | |
font-size: @baseFontSize - 2px; | |
line-height: @baseLineHeight - 2px; | |
} | |
// Mini | |
.btn-mini { | |
padding: 2px 6px; | |
font-size: @baseFontSize - 2px; | |
line-height: @baseLineHeight - 4px; | |
} | |
// Alternate buttons | |
// -------------------------------------------------- | |
// Set text color | |
// ------------------------- | |
.btn-primary, | |
.btn-primary:hover, | |
.btn-warning, | |
.btn-warning:hover, | |
.btn-danger, | |
.btn-danger:hover, | |
.btn-success, | |
.btn-success:hover, | |
.btn-info, | |
.btn-info:hover, | |
.btn-inverse, | |
.btn-inverse:hover { | |
text-shadow: 0 -1px 0 rgba(0,0,0,.25); | |
color: @white; | |
} | |
// Provide *some* extra contrast for those who can get it | |
.btn-primary.active, | |
.btn-warning.active, | |
.btn-danger.active, | |
.btn-success.active, | |
.btn-info.active, | |
.btn-inverse.active { | |
color: rgba(255,255,255,.75); | |
} | |
// Set the backgrounds | |
// ------------------------- | |
.btn-primary { | |
.buttonBackground(@btnPrimaryBackground, @btnPrimaryBackgroundHighlight); | |
} | |
// Warning appears are orange | |
.btn-warning { | |
.buttonBackground(@btnWarningBackground, @btnWarningBackgroundHighlight); | |
} | |
// Danger and error appear as red | |
.btn-danger { | |
.buttonBackground(@btnDangerBackground, @btnDangerBackgroundHighlight); | |
} | |
// Success appears as green | |
.btn-success { | |
.buttonBackground(@btnSuccessBackground, @btnSuccessBackgroundHighlight); | |
} | |
// Info appears as a neutral blue | |
.btn-info { | |
.buttonBackground(@btnInfoBackground, @btnInfoBackgroundHighlight); | |
} | |
// Inverse appears as dark gray | |
.btn-inverse { | |
.buttonBackground(@btnInverseBackground, @btnInverseBackgroundHighlight); | |
} | |
//Start bootstrap button |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment