├── Rakefile ├── .gitignore ├── lib ├── responsive-sass │ └── version.rb └── responsive-sass.rb ├── Gemfile ├── CHANGELOG.mkdn ├── responsive-sass.gemspec ├── stylesheets ├── partials │ └── _base.scss ├── _responsive-sass.scss └── _normalize.scss └── README.mkdn /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | .bundle 3 | Gemfile.lock 4 | pkg/* 5 | .DS_store 6 | -------------------------------------------------------------------------------- /lib/responsive-sass/version.rb: -------------------------------------------------------------------------------- 1 | module Compass 2 | module Responsive 3 | VERSION = "0.1.1" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | 3 | # Specify your gem's dependencies in responsive-sass.gemspec 4 | gemspec 5 | -------------------------------------------------------------------------------- /lib/responsive-sass.rb: -------------------------------------------------------------------------------- 1 | require "responsive-sass/version" 2 | module Compass 3 | module Responsive 4 | base_directory = File.join(File.dirname(__FILE__), '..') 5 | Compass::Frameworks.register('responsive-sass', :path => base_directory) 6 | end 7 | end -------------------------------------------------------------------------------- /CHANGELOG.mkdn: -------------------------------------------------------------------------------- 1 | # Responsive Sass Changelog 2 | 3 | ## 0.1.0 4 | - Mixins are now using em's 5 | - Added normalize.css a alternative for reset. 6 | - Added Frameless Grid to gem [FRAMELESS] (http://framelessgrid.com.) 7 | - Added the option to hide elements using display:none. 8 | - Added the option to change your font-size using $font-size. 9 | - Added the option to change your margins using $margin 10 | - Added em function to easy convert your pixels to ems [TheSassWay] (http://thesassway.com/intermediate/responsive-web-design-part-1) 11 | - Height on backgrounds can now be accessed using $height 12 | 13 | ## 0.0.2 14 | - Added ability to change your background image depending on size or devise resolution. 15 | - Fixed issue with height being required. 16 | - Added mixin to kill webkit link highlighting -------------------------------------------------------------------------------- /responsive-sass.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | $:.push File.expand_path("../lib", __FILE__) 3 | require "responsive-sass/version" 4 | 5 | Gem::Specification.new do |s| 6 | s.name = "responsive-sass" 7 | s.version = Compass::Responsive::VERSION 8 | s.authors = ["Nick Treadway"] 9 | s.email = ["rnt@yeti-media.com"] 10 | s.homepage = "http://ntreadway.github.com/responsive-sass/welcome" 11 | s.summary = %q{Responsive Sass} 12 | s.description = %q{Responsive Sass design using media queries for Compass.} 13 | 14 | s.rubyforge_project = "responsive-sass" 15 | 16 | s.files = `git ls-files`.split("\n") 17 | s.files += %w(README.mkdn) 18 | s.files += Dir.glob("stylesheets/**/*.*") 19 | s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") 20 | s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } 21 | s.require_paths = ["lib"] 22 | 23 | 24 | s.rubygems_version = %q{1.3.6} 25 | s.add_development_dependency("rake") 26 | s.add_dependency("compass", [">= 0.11"]) 27 | end 28 | -------------------------------------------------------------------------------- /stylesheets/partials/_base.scss: -------------------------------------------------------------------------------- 1 | $font-size: 16px; // Your base font-size in pixels 2 | $em: $font-size / 1em; // Shorthand for outputting ems 3 | $margin: 0 auto; 4 | $column: 48px; // The column-width of your grid in pixels 5 | $gutter: 24px; // The gutter-width of your grid in pixels 6 | 7 | 8 | // 9 | // Column-widths in variables, in ems 10 | // 11 | 12 | $cols1: ( 1 * ($column + $gutter) - $gutter) / $em; 13 | $cols2: ( 2 * ($column + $gutter) - $gutter) / $em; 14 | $cols3: ( 3 * ($column + $gutter) - $gutter) / $em; 15 | $cols4: ( 4 * ($column + $gutter) - $gutter) / $em; 16 | $cols5: ( 5 * ($column + $gutter) - $gutter) / $em; 17 | $cols6: ( 6 * ($column + $gutter) - $gutter) / $em; 18 | $cols7: ( 7 * ($column + $gutter) - $gutter) / $em; 19 | $cols8: ( 8 * ($column + $gutter) - $gutter) / $em; 20 | $cols9: ( 9 * ($column + $gutter) - $gutter) / $em; 21 | $cols10: (10 * ($column + $gutter) - $gutter) / $em; 22 | $cols11: (11 * ($column + $gutter) - $gutter) / $em; 23 | $cols12: (12 * ($column + $gutter) - $gutter) / $em; 24 | $cols13: (13 * ($column + $gutter) - $gutter) / $em; 25 | $cols14: (14 * ($column + $gutter) - $gutter) / $em; 26 | $cols15: (15 * ($column + $gutter) - $gutter) / $em; 27 | $cols16: (16 * ($column + $gutter) - $gutter) / $em; -------------------------------------------------------------------------------- /stylesheets/_responsive-sass.scss: -------------------------------------------------------------------------------- 1 | @import "partials/base"; 2 | 3 | @mixin reponsive-core($width, $height: auto, $background: false, $display: false, $font-size: $font-size, $margin: $margin) { 4 | height: $height; 5 | width: $width; 6 | font-size: $font-size; 7 | margin: $margin; 8 | @if $background { 9 | background-image: url($background); 10 | -webkit-background-size: $width $height; 11 | -moz-background-size: $width $height; 12 | background-size: $width $height; 13 | } 14 | @if $display { 15 | display: none; 16 | } 17 | 18 | } 19 | 20 | @mixin min-width-960($width, $height: auto, $background: false, $display: false, $font-size: $font-size, $margin: $margin){ 21 | @media only screen and (min-width: 60em) { 22 | @include reponsive-core($width, $height, $background, $display: false, $font-size: $font-size, $margin: $margin); 23 | } 24 | } 25 | 26 | @mixin tablet-portrait($width, $height: auto, $background: false, $display: false, $font-size: $font-size, $margin: $margin) { 27 | @media only screen and (min-width: 48em) and (max-width: 59.938em) { 28 | @include reponsive-core($width, $height, $background, $display: false, $font-size: $font-size, $margin: $margin); 29 | } 30 | } 31 | 32 | @mixin tablet-landscape($width, $height: auto, $background: false, $display: false, $font-size: $font-size, $margin: $margin){ 33 | @media only screen and (max-width: 65em) { 34 | @include reponsive-core($width, $height, $background, $display: false, $font-size: $font-size, $margin: $margin); 35 | } 36 | } 37 | 38 | @mixin mobile-landscape($width, $height: auto, $background: false, $display: false, $font-size: $font-size, $margin: $margin) { 39 | @media only screen and (min-width: 30em) { 40 | @include reponsive-core($width, $height, $background, $display: false, $font-size: $font-size, $margin: $margin); 41 | } 42 | } 43 | 44 | @mixin mobile-portrait($width, $height: auto, $background: false, $display: false, $font-size: $font-size, $margin: $margin) { 45 | @media only screen and (max-width: 29.938em) { 46 | @include reponsive-core($width, $height, $background, $display: false, $font-size: $font-size, $margin: $margin); 47 | } 48 | } 49 | 50 | 51 | // Misc mixins 52 | @mixin high-res($width, $height: auto, $background: false, $display: false, $font-size: $font-size, $margin: $margin){ 53 | /* iPhone 4 and other high pixel ratio devices ----------- */ 54 | @media 55 | only screen and (-webkit-min-device-pixel-ratio: 2), 56 | only screen and (-o-min-device-pixel-ratio: 3/2), 57 | only screen and (min-device-pixel-ratio: 2) { 58 | @include reponsive-core($width, $height, $background, $display: false, $font-size: $font-size, $margin: $margin); 59 | } 60 | } 61 | 62 | @mixin kill-mobile-zoom { 63 | -webkit-text-size-adjust: 100%; 64 | -ms-text-size-adjust: none; 65 | } 66 | 67 | @mixin kill-tap-highlight { 68 | -webkit-tap-highlight-color: rgba(0,0,0,0); 69 | } 70 | 71 | 72 | /*If you wanted to add the equivalent of a 12px left padding to an h2 set at a font-size of 32px you could use it like this: 73 | h2 { 74 | padding-left: calc-em(12px, 32px); 75 | } 76 | More info can be found here => http://thesassway.com/intermediate/responsive-web-design-part-1*/ 77 | 78 | @function calc-em($target-px, $context) { 79 | @return ($target-px / $context) * 1em; 80 | } 81 | 82 | 83 | 84 | /* 85 | Frameless http://framelessgrid.com/ 86 | by Joni Korpi http://jonikorpi.com/ 87 | licensed under CC0 http://creativecommons.org/publicdomain/zero/1.0/ 88 | Modified by Nick Treadway http://twitter.com/nicktea 89 | */ 90 | 91 | 92 | // 93 | // Column-widths in a mixin, in ems 94 | // 95 | 96 | @mixin width ($cols:1) { 97 | width: ($cols * ($column + $gutter) - $gutter) / $em; 98 | } 99 | 100 | 101 | /* 102 | Margin, padding, and border resets 103 | except for form elements 104 | */ 105 | 106 | body, div, 107 | h1, h2, h3, h4, h5, h6, 108 | p, blockquote, pre, dl, dt, dd, ol, ul, li, 109 | fieldset, form, label, legend, th, td, 110 | article, aside, figure, footer, header, hgroup, menu, nav, section { 111 | margin: 0; 112 | padding: 0; 113 | border: 0; 114 | } 115 | 116 | 117 | 118 | /* 119 | An easy way to zoom your entire layout in or out (as long as it's set in ems). 120 | Just change the media queries to activate them. 121 | Assuming your base font-size is 16: 122 | - the first one zooms out by a factor of (16-2)/16 = 0.875 123 | - the second one zooms in by a factor of (16+2)/16 = 1.125 124 | */ 125 | 126 | @media screen and (max-width: 1px) { 127 | body { 128 | font-size: ($font-size - 2) / $em; 129 | } 130 | } 131 | 132 | @media screen and (max-width: 1px) { 133 | body { 134 | font-size: ($font-size + 2) / $em; 135 | } 136 | } -------------------------------------------------------------------------------- /README.mkdn: -------------------------------------------------------------------------------- 1 | Responsive Sass - Compass plugin 2 | ==================== 3 | 4 | Responsive Sass mixins currently supports the Frameless grid, background image resizing, killing mobile zoom and works in all modern desktop/mobile browsers. Additional support 5 | for Internet Explorer and older browsers is made possible with a small amount 6 | of JavaScript using [Respond](http://github.com/scottjehl/Respond). 7 | 8 | 9 | Installation 10 | ============ 11 | 12 | From the command line: 13 | 14 | gem install responsive-sass 15 | 16 | Add to a Rails project: 17 | 18 | // your.scss 19 | @import 'responsive-sass' 20 | 21 | Or create a new project: 22 | 23 | gem install compass 24 | gem install responsive-sass 25 | compass create -r responsive-sass path_to_project 26 | 27 | * Tell Compass to watch your files 28 | 29 | compass watch path_to_project 30 | 31 | * In your screen.scss add 32 | 33 | @import "responsive-sass"; 34 | 35 | 36 | 37 | To use with the Serve Gem 38 | 39 | // compass.config 40 | require 'responsive-sass' 41 | 42 | Media Query Mixins: 43 | ================== 44 | 45 | Note: Setting your elements height or background is not required. 46 | 47 | - Your can set your background image by passing your image url to the background variable. 48 | - You can hide any element by passing $display: true 49 | 50 | min-width-960 51 | 52 | @include min-width-960($width, $height, "/images/high-res.png"); 53 | 54 | tablet-portrait 55 | 56 | @include tablet-portrait($width, $height, "/images/high-res.png"); 57 | 58 | tablet-landscape 59 | 60 | @include tablet-landscape($width, $height, "/images/high-res.png"); 61 | 62 | mobile-landscape 63 | 64 | @include mobile-landscape($width, $height, "/images/high-res.png"); 65 | 66 | mobile-portrait 67 | 68 | @include mobile-portrait($width, $height, "/images/high-res.png"); 69 | 70 | high-res 71 | 72 | @include high-res($width, $height, "/images/high-res.png"); 73 | 74 | Frameless Config 75 | ================ 76 | $font-size: 16px; // Your base font-size in pixels 77 | $em: $font-size / 1em; // Shorthand for outputting ems 78 | 79 | $column: 48px; // The column-width of your grid in pixels 80 | $gutter: 24px; // The gutter-width of your grid in pixels 81 | 82 | Column-widths in variables, in ems 83 | 84 | $cols1: ( 1 * ($column + $gutter) - $gutter) / $em; 85 | $cols2: ( 2 * ($column + $gutter) - $gutter) / $em; 86 | $cols3: ( 3 * ($column + $gutter) - $gutter) / $em; 87 | $cols4: ( 4 * ($column + $gutter) - $gutter) / $em; 88 | $cols5: ( 5 * ($column + $gutter) - $gutter) / $em; 89 | $cols6: ( 6 * ($column + $gutter) - $gutter) / $em; 90 | $cols7: ( 7 * ($column + $gutter) - $gutter) / $em; 91 | $cols8: ( 8 * ($column + $gutter) - $gutter) / $em; 92 | $cols9: ( 9 * ($column + $gutter) - $gutter) / $em; 93 | $cols10: (10 * ($column + $gutter) - $gutter) / $em; 94 | $cols11: (11 * ($column + $gutter) - $gutter) / $em; 95 | $cols12: (12 * ($column + $gutter) - $gutter) / $em; 96 | $cols13: (13 * ($column + $gutter) - $gutter) / $em; 97 | $cols14: (14 * ($column + $gutter) - $gutter) / $em; 98 | $cols15: (15 * ($column + $gutter) - $gutter) / $em; 99 | $cols16: (16 * ($column + $gutter) - $gutter) / $em; 100 | 101 | Column-widths in a mixin, in ems 102 | 103 | @mixin width ($cols:1) { 104 | width: ($cols * ($column + $gutter) - $gutter) / $em; 105 | } 106 | 107 | 108 | An easy way to zoom your entire layout in or out (as long as it's set in ems). 109 | Just change the media queries to activate them. 110 | Assuming your base font-size is 16: 111 | - the first one zooms out by a factor of (16-2)/16 = 0.875 112 | - the second one zooms in by a factor of (16+2)/16 = 1.125 113 | 114 | @media screen and (max-width: 1px) { 115 | body { 116 | font-size: ($font-size - 2) / $em; 117 | } 118 | } 119 | 120 | @media screen and (max-width: 1px) { 121 | body { 122 | font-size: ($font-size + 2) / $em; 123 | } 124 | } 125 | 126 | [More Info] (http://framelessgrid.com/) 127 | 128 | Normalize.css 129 | ============= 130 | 131 | Simply use: 132 | 133 | @import "normalize"; 134 | 135 | Misc Mixins: 136 | =========== 137 | 138 | kill-mobile-zoom 139 | 140 | @include kill-mobile-zoom; 141 | 142 | kill-tap-highlight 143 | 144 | @include kill-tap-highlight; 145 | 146 | License: 147 | ======= 148 | Copyright (c) 2011 [Nick Treadway] (http://twitter.com/nicktea) 149 | All Rights Reserved. 150 | 151 | Licensed under the [MIT license] (http://www.opensource.org/licenses/mit-license.php) 152 | 153 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 154 | 155 | [Frameless Grid] (http://framelessgrid.com/) by [Joni Korpi] (http://jonikorpi.com) is licensed under 156 | [CC0](http://creativecommons.org/publicdomain/zero/1.0/) -------------------------------------------------------------------------------- /stylesheets/_normalize.scss: -------------------------------------------------------------------------------- 1 | /*! normalize.css 2012-02-07T12:37 UTC - http://github.com/necolas/normalize.css */ 2 | 3 | /* ============================================================================= 4 | HTML5 display definitions 5 | ========================================================================== */ 6 | 7 | /* 8 | * Corrects block display not defined in IE6/7/8/9 & FF3 9 | */ 10 | 11 | article, 12 | aside, 13 | details, 14 | figcaption, 15 | figure, 16 | footer, 17 | header, 18 | hgroup, 19 | nav, 20 | section, 21 | summary { 22 | display: block; 23 | } 24 | 25 | /* 26 | * Corrects inline-block display not defined in IE6/7/8/9 & FF3 27 | */ 28 | 29 | audio, 30 | canvas, 31 | video { 32 | display: inline-block; 33 | *display: inline; 34 | *zoom: 1; 35 | } 36 | 37 | /* 38 | * Prevents modern browsers from displaying 'audio' without controls 39 | */ 40 | 41 | audio:not([controls]) { 42 | display: none; 43 | } 44 | 45 | /* 46 | * Addresses styling for 'hidden' attribute not present in IE7/8/9, FF3, S4 47 | * Known issue: no IE6 support 48 | */ 49 | 50 | [hidden] { 51 | display: none; 52 | } 53 | 54 | 55 | /* ============================================================================= 56 | Base 57 | ========================================================================== */ 58 | 59 | /* 60 | * 1. Corrects text resizing oddly in IE6/7 when body font-size is set using em units 61 | * http://clagnut.com/blog/348/#c790 62 | * 2. Prevents iOS text size adjust after orientation change, without disabling user zoom 63 | * www.456bereastreet.com/archive/201012/controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/ 64 | */ 65 | 66 | html { 67 | font-size: 100%; /* 1 */ 68 | -webkit-text-size-adjust: 100%; /* 2 */ 69 | -ms-text-size-adjust: 100%; /* 2 */ 70 | } 71 | 72 | /* 73 | * Addresses font-family inconsistency between 'textarea' and other form elements. 74 | */ 75 | 76 | html, 77 | button, 78 | input, 79 | select, 80 | textarea { 81 | font-family: sans-serif; 82 | } 83 | 84 | /* 85 | * Addresses margins handled incorrectly in IE6/7 86 | */ 87 | 88 | body { 89 | margin: 0; 90 | } 91 | 92 | 93 | /* ============================================================================= 94 | Links 95 | ========================================================================== */ 96 | 97 | /* 98 | * Addresses outline displayed oddly in Chrome 99 | */ 100 | 101 | a:focus { 102 | outline: thin dotted; 103 | } 104 | 105 | /* 106 | * Improves readability when focused and also mouse hovered in all browsers 107 | * people.opera.com/patrickl/experiments/keyboard/test 108 | */ 109 | 110 | a:hover, 111 | a:active { 112 | outline: 0; 113 | } 114 | 115 | 116 | /* ============================================================================= 117 | Typography 118 | ========================================================================== */ 119 | 120 | /* 121 | * Addresses font sizes and margins set differently in IE6/7 122 | * Addresses font sizes within 'section' and 'article' in FF4+, Chrome, S5 123 | */ 124 | 125 | h1 { 126 | font-size: 2em; 127 | margin: 0.67em 0; 128 | } 129 | 130 | h2 { 131 | font-size: 1.5em; 132 | margin: 0.83em 0; 133 | } 134 | 135 | h3 { 136 | font-size: 1.17em; 137 | margin: 1em 0; 138 | } 139 | 140 | h4 { 141 | font-size: 1em; 142 | margin: 1.33em 0; 143 | } 144 | 145 | h5 { 146 | font-size: 0.83em; 147 | margin: 1.67em 0; 148 | } 149 | 150 | h6 { 151 | font-size: 0.75em; 152 | margin: 2.33em 0; 153 | } 154 | 155 | /* 156 | * Addresses styling not present in IE7/8/9, S5, Chrome 157 | */ 158 | 159 | abbr[title] { 160 | border-bottom: 1px dotted; 161 | } 162 | 163 | /* 164 | * Addresses style set to 'bolder' in FF3+, S4/5, Chrome 165 | */ 166 | 167 | b, 168 | strong { 169 | font-weight: bold; 170 | } 171 | 172 | blockquote { 173 | margin: 1em 40px; 174 | } 175 | 176 | /* 177 | * Addresses styling not present in S5, Chrome 178 | */ 179 | 180 | dfn { 181 | font-style: italic; 182 | } 183 | 184 | /* 185 | * Addresses styling not present in IE6/7/8/9 186 | */ 187 | 188 | mark { 189 | background: #ff0; 190 | color: #000; 191 | } 192 | 193 | /* 194 | * Addresses margins set differently in IE6/7 195 | */ 196 | 197 | p, 198 | pre { 199 | margin: 1em 0; 200 | } 201 | 202 | /* 203 | * Corrects font family set oddly in IE6, S4/5, Chrome 204 | * en.wikipedia.org/wiki/User:Davidgothberg/Test59 205 | */ 206 | 207 | pre, 208 | code, 209 | kbd, 210 | samp { 211 | font-family: monospace, serif; 212 | _font-family: 'courier new', monospace; 213 | font-size: 1em; 214 | } 215 | 216 | /* 217 | * Improves readability of pre-formatted text in all browsers 218 | */ 219 | 220 | pre { 221 | white-space: pre; 222 | white-space: pre-wrap; 223 | word-wrap: break-word; 224 | } 225 | 226 | /* 227 | * 1. Addresses CSS quotes not supported in IE6/7 228 | * 2. Addresses quote property not supported in S4 229 | */ 230 | 231 | /* 1 */ 232 | 233 | q { 234 | quotes: none; 235 | } 236 | 237 | /* 2 */ 238 | 239 | q:before, 240 | q:after { 241 | content: ''; 242 | content: none; 243 | } 244 | 245 | small { 246 | font-size: 75%; 247 | } 248 | 249 | /* 250 | * Prevents sub and sup affecting line-height in all browsers 251 | * gist.github.com/413930 252 | */ 253 | 254 | sub, 255 | sup { 256 | font-size: 75%; 257 | line-height: 0; 258 | position: relative; 259 | vertical-align: baseline; 260 | } 261 | 262 | sup { 263 | top: -0.5em; 264 | } 265 | 266 | sub { 267 | bottom: -0.25em; 268 | } 269 | 270 | 271 | /* ============================================================================= 272 | Lists 273 | ========================================================================== */ 274 | 275 | /* 276 | * Addresses margins set differently in IE6/7 277 | */ 278 | 279 | dl, 280 | menu, 281 | ol, 282 | ul { 283 | margin: 1em 0; 284 | } 285 | 286 | dd { 287 | margin: 0 0 0 40px; 288 | } 289 | 290 | /* 291 | * Addresses paddings set differently in IE6/7 292 | */ 293 | 294 | menu, 295 | ol, 296 | ul { 297 | padding: 0 0 0 40px; 298 | } 299 | 300 | /* 301 | * Corrects list images handled incorrectly in IE7 302 | */ 303 | 304 | nav ul, 305 | nav ol { 306 | list-style: none; 307 | list-style-image: none; 308 | } 309 | 310 | 311 | /* ============================================================================= 312 | Embedded content 313 | ========================================================================== */ 314 | 315 | /* 316 | * 1. Removes border when inside 'a' element in IE6/7/8/9, FF3 317 | * 2. Improves image quality when scaled in IE7 318 | * code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/ 319 | */ 320 | 321 | img { 322 | border: 0; /* 1 */ 323 | -ms-interpolation-mode: bicubic; /* 2 */ 324 | } 325 | 326 | /* 327 | * Corrects overflow displayed oddly in IE9 328 | */ 329 | 330 | svg:not(:root) { 331 | overflow: hidden; 332 | } 333 | 334 | 335 | /* ============================================================================= 336 | Figures 337 | ========================================================================== */ 338 | 339 | /* 340 | * Addresses margin not present in IE6/7/8/9, S5, O11 341 | */ 342 | 343 | figure { 344 | margin: 0; 345 | } 346 | 347 | 348 | /* ============================================================================= 349 | Forms 350 | ========================================================================== */ 351 | 352 | /* 353 | * Corrects margin displayed oddly in IE6/7 354 | */ 355 | 356 | form { 357 | margin: 0; 358 | } 359 | 360 | /* 361 | * Define consistent border, margin, and padding 362 | */ 363 | 364 | fieldset { 365 | border: 1px solid #c0c0c0; 366 | margin: 0 2px; 367 | padding: 0.35em 0.625em 0.75em; 368 | } 369 | 370 | /* 371 | * 1. Corrects color not being inherited in IE6/7/8/9 372 | * 2. Corrects text not wrapping in FF3 373 | * 3. Corrects alignment displayed oddly in IE6/7 374 | */ 375 | 376 | legend { 377 | border: 0; /* 1 */ 378 | padding: 0; 379 | white-space: normal; /* 2 */ 380 | *margin-left: -7px; /* 3 */ 381 | } 382 | 383 | /* 384 | * 1. Corrects font size not being inherited in all browsers 385 | * 2. Addresses margins set differently in IE6/7, FF3+, S5, Chrome 386 | * 3. Improves appearance and consistency in all browsers 387 | */ 388 | 389 | button, 390 | input, 391 | select, 392 | textarea { 393 | font-size: 100%; /* 1 */ 394 | margin: 0; /* 2 */ 395 | vertical-align: baseline; /* 3 */ 396 | *vertical-align: middle; /* 3 */ 397 | } 398 | 399 | /* 400 | * Addresses FF3/4 setting line-height on 'input' using !important in the UA stylesheet 401 | */ 402 | 403 | button, 404 | input { 405 | line-height: normal; /* 1 */ 406 | } 407 | 408 | /* 409 | * 1. Improves usability and consistency of cursor style between image-type 'input' and others 410 | * 2. Corrects inability to style clickable 'input' types in iOS 411 | * 3. Removes inner spacing in IE7 without affecting normal text inputs 412 | * Known issue: inner spacing remains in IE6 413 | */ 414 | 415 | button, 416 | input[type="button"], 417 | input[type="reset"], 418 | input[type="submit"] { 419 | cursor: pointer; /* 1 */ 420 | -webkit-appearance: button; /* 2 */ 421 | *overflow: visible; /* 3 */ 422 | } 423 | 424 | /* 425 | * Re-set default cursor for disabled elements 426 | */ 427 | 428 | button[disabled], 429 | input[disabled] { 430 | cursor: default; 431 | } 432 | 433 | /* 434 | * 1. Addresses box sizing set to content-box in IE8/9 435 | * 2. Removes excess padding in IE8/9 436 | * 3. Removes excess padding in IE7 437 | Known issue: excess padding remains in IE6 438 | */ 439 | 440 | input[type="checkbox"], 441 | input[type="radio"] { 442 | box-sizing: border-box; /* 1 */ 443 | padding: 0; /* 2 */ 444 | *height: 13px; /* 3 */ 445 | *width: 13px; /* 3 */ 446 | } 447 | 448 | /* 449 | * 1. Addresses appearance set to searchfield in S5, Chrome 450 | * 2. Addresses box-sizing set to border-box in S5, Chrome (include -moz to future-proof) 451 | */ 452 | 453 | input[type="search"] { 454 | -webkit-appearance: textfield; /* 1 */ 455 | -moz-box-sizing: content-box; 456 | -webkit-box-sizing: content-box; /* 2 */ 457 | box-sizing: content-box; 458 | } 459 | 460 | /* 461 | * Removes inner padding and search cancel button in S5, Chrome on OS X 462 | */ 463 | 464 | input[type="search"]::-webkit-search-decoration, 465 | input[type="search"]::-webkit-search-cancel-button { 466 | -webkit-appearance: none; 467 | } 468 | 469 | /* 470 | * Removes inner padding and border in FF3+ 471 | * www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/ 472 | */ 473 | 474 | button::-moz-focus-inner, 475 | input::-moz-focus-inner { 476 | border: 0; 477 | padding: 0; 478 | } 479 | 480 | /* 481 | * 1. Removes default vertical scrollbar in IE6/7/8/9 482 | * 2. Improves readability and alignment in all browsers 483 | */ 484 | 485 | textarea { 486 | overflow: auto; /* 1 */ 487 | vertical-align: top; /* 2 */ 488 | } 489 | 490 | 491 | /* ============================================================================= 492 | Tables 493 | ========================================================================== */ 494 | 495 | /* 496 | * Remove most spacing between table cells 497 | */ 498 | 499 | table { 500 | border-collapse: collapse; 501 | border-spacing: 0; 502 | } 503 | --------------------------------------------------------------------------------