Skip to content

Instantly share code, notes, and snippets.

@jcanfield
Created August 5, 2012 22:45
Show Gist options
  • Save jcanfield/3267623 to your computer and use it in GitHub Desktop.
Save jcanfield/3267623 to your computer and use it in GitHub Desktop.
Formalize.css Theme for Compass/SASS (SCSS)
.input_tiny {
width: 50px;
}
.input_small {
width: 100px;
}
.input_medium {
width: 150px;
}
.input_large {
width: 200px;
}
.input_xlarge {
width: 250px;
}
.input_xxlarge {
width: 300px;
}
.input_full {
width: 100%;
}
.input_full_wrap { // Added via JS to <textarea> and class="input-full". Applies only to IE7. Other browsers don't need it.
display: block;
padding-right: 8px;
}
input[type="search"]::-webkit-search-decoration { // `UI Consistency
display: none;
}
input,
button,
select,
textarea { // For Firefox // Suppress red glow that Firefox adds to form fields by default.
&:invalid {
@include box-shadow(none);
}
&:focus { // Add blue glow.
@include box-shadow(#0066ff 0 0 5px 0);
// for Opera
z-index: 1;
}
}
input[type="file"],
input[type="radio"],
input[type="checkbox"] {
&:focus,
&:active {
@include box-shadow(none);
}
}
button,
input[type="reset"],
input[type="submit"],
input[type="button"] {
-webkit-appearance: none;
@include border-radius(4px);
@include background-clip(padding-box);
background: #dddddd image-url("http://www.danavmusic.com/wp-content/plugins/danavmusic-online-registration/lib/jquery-formalize/formalize-latest/nathansmith-formalize-0870706/assets/images/button.png") repeat-x;
@include background-image(linear-gradient(white, #dddddd));
border: 1px solid;
border-color: #dddddd #bbbbbb #999999;
cursor: pointer;
color: #333333; // Helvetica Neue present, because it works better for line-height on buttons than Arial, on OS X.
font: bold 12px / 1.3 "Helvetica Neue", Arial, "Liberation Sans", FreeSans, sans-serif;
outline: 0;
overflow: visible;
margin: 0;
padding: 3px 10px;
text-shadow: white 0 1px 1px;
vertical-align: top;
width: auto;
&:hover {
@include background-image(linear-gradient(white, #eeeeee 1px, #cccccc));
}
&:active {
@include background-image(linear-gradient(white, #dddddd 1px, #eeeeee));
@include box-shadow(inset rgba(black, 0.25) 0 1px 2px 0);
border-color: #999999 #bbbbbb #dddddd;
}
*padding-top: 2px; // IE7
*padding-bottom: 0;
&::-moz-focus-inner { // Kill phantom spacing and dotted border that appears in Firefox.
border: 0;
padding: 0;
}
}
button {
*padding-top: 1px; // IE7
*padding-bottom: 1px;
}
textarea,
select,
input[type="date"],
input[type="datetime"],
input[type="datetime-local"],
input[type="email"],
input[type="month"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="text"],
input[type="time"],
input[type="url"],
input[type="week"] {
@include box-sizing(border-box);
@include background-clip(padding-box);
@include border-radius(0);
-webkit-appearance: none;
background-color: white;
border: 1px solid;
border-color: #848484 #c1c1c1 #e1e1e1;
color: black;
outline: 0;
margin: 0;
padding: 2px 3px;
text-align: left;
font-size: 13px;
font-family: Arial, "Liberation Sans", FreeSans, sans-serif; // Leaving out Helvetica Neue, to not throw off size="..." on inputs. Arial is more reliable, on Windows and OS X.
height: 1.8em;
vertical-align: top;
*padding-top: 2px; // IE7
*padding-bottom: 1px;
*height: auto;
&[disabled] {
background-color: #eeeeee;
}
}
button[disabled],
input[disabled],
select[disabled],
select[disabled] option,
select[disabled] optgroup,
textarea[disabled] {
@include box-shadow(none);
-moz-user-select: -moz-none;
-webkit-user-select: none;
-khtml-user-select: none;
user-select: none;
color: #888888;
cursor: default;
}
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder { // Separate rule for Firefox. Separate rule for IE, too. Cannot stack with WebKit's.
color: #888888;
}
input:-moz-placeholder,
textarea:-moz-placeholder {
color: #888888;
}
input.placeholder_text,
textarea.placeholder_text {
color: #888888;
}
textarea,
select[size],
select[multiple] {
height: auto;
}
select[size="0"],
select[size="1"] { // Set height back to normal, for Opera, WebKit, and IE.
height: 1.8em;
*height: auto; // IE7
}
@media (#{-webkit-min-device-pixel-ratio}: #{0}) { // Tweaks for Safari + Chrome.
select[size],
select[multiple],
select[multiple][size] {
background-image: none;
padding-right: 3px;
}
select,
select[size="0"],
select[size="1"] { // Base64 encoded "../images/select_arrow.gif"
background-image: url(data:image/png;base64,R0lGODlhDQAEAIAAAAAAAP8A/yH5BAEHAAEALAAAAAANAAQAAAILhA+hG5jMDpxvhgIAOw==);
background-repeat: no-repeat;
background-position: right center;
padding-right: 20px;
}
::-webkit-validation-bubble-message {
-webkit-box-shadow: none;
box-shadow: none;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #666666), color-stop(1, black));
border: 1px solid;
border-color: #747474 #5e5e5e #4f4f4f;
color: white;
font: 13px / 17px "Lucida Grande", Arial, "Liberation Sans", FreeSans, sans-serif;
overflow: hidden;
padding: 15px 15px 17px;
text-shadow: black 0 0 1px;
height: 16px;
}
::-webkit-validation-bubble-arrow,
::-webkit-validation-bubble-top-outer-arrow,
::-webkit-validation-bubble-top-inner-arrow {
-webkit-box-shadow: none;
box-shadow: none;
background: #666666;
border: 0;
}
}
textarea {
min-height: 40px;
overflow: auto;
resize: vertical;
width: 100%;
}
optgroup {
color: black;
font-style: normal;
font-weight: normal;
font-family: Arial, "Liberation Sans", FreeSans, sans-serif; // Font family repeated, for Firefox.
&::-moz-focus-inner { // Kill phantom spacing and dotted border that appears in Firefox.
border: 0;
padding: 0;
}
}
// IE Fixes to go in your IE.SCSS
// `IE6 - Formalize.css Basic Theme
//----------------------------------------------------------------------------------------------------
// Everything below this line is for IE6.
// Delete it if you don't support it! :)
// Classes are added dynamically via JS,
// because IE6 doesn't support attribute
// selectors: .ie6_button, .ie6_input, etc.
// Note: These style rules are somewhat
// duplicated because IE6 bombs out when
// it sees attribute selectors. Example:
// .ie6_button {
// This works in IE6.
// }
// .ie6_button,
// input[type=submit] {
// This doesn't work.
// }
.ie6_button,
* html button {
background: #dddddd image-url("http://www.danavmusic.com/wp-content/plugins/danavmusic-online-registration/lib/jquery-formalize/formalize-latest/nathansmith-formalize-0870706/assets/images/button.png") repeat-x;
border: 1px solid;
border-color: #dddddd #bbbbbb #999999;
cursor: pointer;
color: #333333;
font: bold 12px / 1.2 Arial, sans-serif;
padding: 2px 10px 0px;
overflow: visible;
width: auto;
}
* html button {
padding-top: 1px;
padding-bottom: 1px;
}
.ie6_input,
* html textarea,
* html select {
background: white;
border: 1px solid;
border-color: #848484 #c1c1c1 #e1e1e1;
color: black;
padding: 2px 3px 1px;
font-size: 13px;
font-family: Arial, sans-serif;
vertical-align: top;
}
* html select {
margin-top: 1px;
}
.placeholder_text,
.ie6_input_disabled,
.ie6_button_disabled {
color: #888888;
}
.ie6_input_disabled {
background: #eeeeee;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment