Skip to content

Instantly share code, notes, and snippets.

@jlong
Created September 23, 2010 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jlong/594602 to your computer and use it in GitHub Desktop.
Save jlong/594602 to your computer and use it in GitHub Desktop.
A nice multi-line button mixin for Sass and Compass
<p>
<a href="/signup/" class="multiline_button blue" style="width: 245px">
<big>Start Free Trial</big>
<small>30-days free! Signup in 60 seconds</small>
</a>
</p>
<p>
<a href="/signup/" class="multiline_button brown" style="width: 245px">
<big>Start Free Trial</big>
<small>30-days free! Signup in 60 seconds</small>
</a>
</p>
=multiline-button($base-color: none)
background-color: #5fa2d8
+linear-gradient(color-stops(#8cbadf, #60a3d8, #4294d4))
border-width: 1px
border-style: solid
+border-radius(6px)
color: white
display: block
padding: 12px 10px
text-align: center
text-decoration: none
big
font-size: 24px
font-weight: bold
display: block
+opacity(0.9)
small
font-size: 14px
display: block
margin-top: 4px
+opacity(0.7)
&:active
padding: 13px 10px 11px
+opacity(1)
@if $base-color != none
+color-multiline-button($base-color)
=color-multiline-button($base-color)
$dark-color: darken($base-color, 10%)
$light-color: lighten($base-color, 10%)
$border-color: darken($base-color, 20%)
$light-border-color: lighten($base-color, 0%)
$highlight-color: transparentize(desaturate(lighten($base-color, 40%), 50%), 0.5)
$shadow-color: darken($base-color, 15%)
$text-shadow-color: darken($base-color, 25%)
background-color: $base-color
+linear-gradient(color-stops($light-color, $base-color, $dark-color))
border-color: $border-color
border-left-color: $light-border-color
border-top-color: $light-border-color
+box-shadow($highlight-color, 1px, 1px, 0, 0, inset)
color: white
+text-shadow($text-shadow-color, 1px, 1px)
&:hover, &:focus
+linear-gradient(color-stops(lighten($light-color, 5%), lighten($base-color, 5%), $dark-color))
&:active, &.depressed
+linear-gradient(color-stops(desaturate(lighten($dark-color, 5%),10%), desaturate($base-color, 10%)))
+box-shadow(none)
border-color: $border-color
a.multiline_button
+multiline-button
+color-multiline-button(#60a3d8)
&.brown
+color-multiline-button(#5b3214)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment