├── .gitignore ├── LICENSE.txt ├── css ├── css-background-size.min.css ├── css-background-size.css ├── background-size.css └── background-size.min.css ├── package.json ├── src └── css-background-size.css └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # List of files for git to ignore 2 | 3 | .DS_Store 4 | .AppleDouble 5 | .LSOverride 6 | 7 | # Icon must end with two \r 8 | Icon 9 | 10 | 11 | # Thumbnails 12 | ._* 13 | 14 | # Files that might appear on external disk 15 | .Spotlight-V100 16 | .Trashes 17 | 18 | # Directories potentially created on remote AFP share 19 | .AppleDB 20 | .AppleDesktop 21 | Network Trash Folder 22 | Temporary Items 23 | .apdisk 24 | 25 | # Vim 26 | Session.vim 27 | 28 | # Node 29 | node_modules/* 30 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | ISC License (ISC) 2 | Copyright (c) 2018, Adam Morse 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 9 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 10 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 11 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 13 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14 | PERFORMANCE OF THIS SOFTWARE. 15 | -------------------------------------------------------------------------------- /css/css-background-size.min.css: -------------------------------------------------------------------------------- 1 | .bg-cv{background-size:cover}.bg-cn{background-size:contain}.bg-quarter{background-size:25%}.bg-half{background-size:50%}.bg-three-quarters{background-size:75%}.bg-full{background-size:100%}.bg-auto{background-size:auto}@media screen and (min-width:48em){.bg-cv-ns{background-size:cover}.bg-cn-ns{background-size:contain}.bg-quarter-ns{background-size:25%}.bg-half-ns{background-size:50%}.bg-three-quarters-ns{background-size:75%}.bg-full-ns{background-size:100%}.bg-auto-ns{background-size:auto}}@media screen and (min-width:48em) and (max-width:64em){.bg-cv-m{background-size:cover}.bg-cn-m{background-size:contain}.bg-quarter-m{background-size:25%}.bg-half-m{background-size:50%}.bg-three-quarters-m{background-size:75%}.bg-full-m{background-size:100%}.bg-auto-m{background-size:auto}}@media screen and (min-width:64em){.bg-cv-l{background-size:cover}.bg-cn-l{background-size:contain}.bg-quarter-l{background-size:25%}.bg-half-l{background-size:50%}.bg-three-quarters-l{background-size:75%}.bg-full-l{background-size:100%}.bg-auto-l{background-size:auto}} 2 | 3 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "css-background-size", 3 | "style": "background-size.css", 4 | "version": "1.0.8", 5 | "homepage": "http://github.com/mrmrs/css-background-size", 6 | "description": "Css module of single purpose classes for background size", 7 | "keywords": [ 8 | "css", 9 | "oocss", 10 | "background-size" 11 | ], 12 | "css-background-size": { 13 | "type": "git", 14 | "url": "http://github.com/mrmrs/css-background-size.git" 15 | }, 16 | "bugs": { 17 | "url": "https://github.com/mrmrs/css-background-size/issues", 18 | "email": "hi@mrmrs.cc" 19 | }, 20 | "author": { 21 | "name": "Adam Morse", 22 | "email": "hi@mrmrs.cc", 23 | "url": "http://mrmrs.cc" 24 | }, 25 | "contributors": [ 26 | { 27 | "name": "Adam Morse", 28 | "email": "hi@mrmrs.cc" 29 | } 30 | ], 31 | "license": "MIT", 32 | "devDependencies": { 33 | "tachyons-cli": "^1.3.0" 34 | }, 35 | "scripts": { 36 | "start": "tachyons src/css-background-size.css > css/css-background-size.css && tachyons src/css-background-size.css --minify > css/css-background-size.min.css && tachyons src/css-background-size.css --generate-docs --package=../../package.json > readme.md" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /css/css-background-size.css: -------------------------------------------------------------------------------- 1 | /* 2 | BACKGROUND SIZE 3 | */ 4 | .bg-cv { background-size: cover; } 5 | .bg-cn { background-size: contain; } 6 | .bg-quarter { background-size: 25%; } 7 | .bg-half { background-size: 50%; } 8 | .bg-three-quarters { background-size: 75%; } 9 | .bg-full { background-size: 100%; } 10 | .bg-auto { background-size: auto; } 11 | @media screen and (min-width: 48em) { 12 | .bg-cv-ns { background-size: cover; } 13 | .bg-cn-ns { background-size: contain; } 14 | .bg-quarter-ns { background-size: 25%; } 15 | .bg-half-ns { background-size: 50%; } 16 | .bg-three-quarters-ns { background-size: 75%; } 17 | .bg-full-ns { background-size: 100%; } 18 | .bg-auto-ns { background-size: auto; } 19 | } 20 | @media screen and (min-width:48em) and (max-width: 64em) { 21 | .bg-cv-m { background-size: cover; } 22 | .bg-cn-m { background-size: contain; } 23 | .bg-quarter-m { background-size: 25%; } 24 | .bg-half-m { background-size: 50%; } 25 | .bg-three-quarters-m { background-size: 75%; } 26 | .bg-full-m { background-size: 100%; } 27 | .bg-auto-m { background-size: auto; } 28 | } 29 | @media screen and (min-width: 64em) { 30 | .bg-cv-l { background-size: cover; } 31 | .bg-cn-l { background-size: contain; } 32 | .bg-quarter-l { background-size: 25%; } 33 | .bg-half-l { background-size: 50%; } 34 | .bg-three-quarters-l { background-size: 75%; } 35 | .bg-full-l { background-size: 100%; } 36 | .bg-auto-l { background-size: auto; } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /css/background-size.css: -------------------------------------------------------------------------------- 1 | /* 2 | BACKGROUND SIZE 3 | */ 4 | 5 | .bg-cv { background-size: cover; } 6 | .bg-cn { background-size: contain; } 7 | .bg-quarter { background-size: 25%; } 8 | .bg-half { background-size: 50%; } 9 | .bg-three-quarters { background-size: 75%; } 10 | .bg-full { background-size: 100%; } 11 | .bg-auto { background-size: auto; } 12 | 13 | @media screen and (min-width: 48em) { 14 | .bg-cv-ns { background-size: cover; } 15 | .bg-cn-ns { background-size: contain; } 16 | .bg-quarter-ns { background-size: 25%; } 17 | .bg-half-ns { background-size: 50%; } 18 | .bg-three-quarters-ns { background-size: 75%; } 19 | .bg-full-ns { background-size: 100%; } 20 | .bg-auto-ns { background-size: auto; } 21 | } 22 | 23 | @media screen and (min-width:48em) and (max-width: 64em) { 24 | .bg-cv-m { background-size: cover; } 25 | .bg-cn-m { background-size: contain; } 26 | .bg-quarter-m { background-size: 25%; } 27 | .bg-half-m { background-size: 50%; } 28 | .bg-three-quarters-m { background-size: 75%; } 29 | .bg-full-m { background-size: 100%; } 30 | .bg-auto-m { background-size: auto; } 31 | } 32 | 33 | @media screen and (min-width: 64em) { 34 | .bg-cv-l { background-size: cover; } 35 | .bg-cn-l { background-size: contain; } 36 | .bg-quarter-l { background-size: 25%; } 37 | .bg-half-l { background-size: 50%; } 38 | .bg-three-quarters-l { background-size: 75%; } 39 | .bg-full-l { background-size: 100%; } 40 | .bg-auto-l { background-size: auto; } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /css/background-size.min.css: -------------------------------------------------------------------------------- 1 | /* 2 | BACKGROUND SIZE 3 | */ 4 | 5 | .bg-cv { background-size: cover; } 6 | .bg-cn { background-size: contain; } 7 | .bg-quarter { background-size: 25%; } 8 | .bg-half { background-size: 50%; } 9 | .bg-three-quarters { background-size: 75%; } 10 | .bg-full { background-size: 100%; } 11 | .bg-auto { background-size: auto; } 12 | 13 | @media screen and (min-width: 48em) { 14 | .bg-cv-ns { background-size: cover; } 15 | .bg-cn-ns { background-size: contain; } 16 | .bg-quarter-ns { background-size: 25%; } 17 | .bg-half-ns { background-size: 50%; } 18 | .bg-three-quarters-ns { background-size: 75%; } 19 | .bg-full-ns { background-size: 100%; } 20 | .bg-auto-ns { background-size: auto; } 21 | } 22 | 23 | @media screen and (min-width:48em) and (max-width: 64em) { 24 | .bg-cv-m { background-size: cover; } 25 | .bg-cn-m { background-size: contain; } 26 | .bg-quarter-m { background-size: 25%; } 27 | .bg-half-m { background-size: 50%; } 28 | .bg-three-quarters-m { background-size: 75%; } 29 | .bg-full-m { background-size: 100%; } 30 | .bg-auto-m { background-size: auto; } 31 | } 32 | 33 | @media screen and (min-width: 64em) { 34 | .bg-cv-l { background-size: cover; } 35 | .bg-cn-l { background-size: contain; } 36 | .bg-quarter-l { background-size: 25%; } 37 | .bg-half-l { background-size: 50%; } 38 | .bg-three-quarters-l { background-size: 75%; } 39 | .bg-full-l { background-size: 100%; } 40 | .bg-auto-l { background-size: auto; } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/css-background-size.css: -------------------------------------------------------------------------------- 1 | /* 2 | BACKGROUND SIZE 3 | */ 4 | 5 | .bg-cv { background-size: cover; } 6 | .bg-cn { background-size: contain; } 7 | .bg-quarter { background-size: 25%; } 8 | .bg-half { background-size: 50%; } 9 | .bg-three-quarters { background-size: 75%; } 10 | .bg-full { background-size: 100%; } 11 | .bg-auto { background-size: auto; } 12 | 13 | @media screen and (min-width: 48em) { 14 | .bg-cv-ns { background-size: cover; } 15 | .bg-cn-ns { background-size: contain; } 16 | .bg-quarter-ns { background-size: 25%; } 17 | .bg-half-ns { background-size: 50%; } 18 | .bg-three-quarters-ns { background-size: 75%; } 19 | .bg-full-ns { background-size: 100%; } 20 | .bg-auto-ns { background-size: auto; } 21 | } 22 | 23 | @media screen and (min-width:48em) and (max-width: 64em) { 24 | .bg-cv-m { background-size: cover; } 25 | .bg-cn-m { background-size: contain; } 26 | .bg-quarter-m { background-size: 25%; } 27 | .bg-half-m { background-size: 50%; } 28 | .bg-three-quarters-m { background-size: 75%; } 29 | .bg-full-m { background-size: 100%; } 30 | .bg-auto-m { background-size: auto; } 31 | } 32 | 33 | @media screen and (min-width: 64em) { 34 | .bg-cv-l { background-size: cover; } 35 | .bg-cn-l { background-size: contain; } 36 | .bg-quarter-l { background-size: 25%; } 37 | .bg-half-l { background-size: 50%; } 38 | .bg-three-quarters-l { background-size: 75%; } 39 | .bg-full-l { background-size: 100%; } 40 | .bg-auto-l { background-size: auto; } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # css-background-size 1.0.6 2 | 3 | Css module of single purpose classes for background size 4 | 5 | #### Stats 6 | 7 | 290 | 28 | 28 8 | ---|---|--- 9 | bytes | selectors | declarations 10 | 11 | ## Installation 12 | 13 | #### With [npm](https://npmjs.com) 14 | 15 | ``` 16 | npm install --save-dev css-background-size 17 | ``` 18 | 19 | Learn more about using css installed with npm: 20 | * https://webpack.github.io/docs/stylesheets.html 21 | * https://github.com/defunctzombie/npm-css 22 | 23 | #### With Git 24 | 25 | http: 26 | ``` 27 | git clone https://github.com/tachyons-css/css-background-size 28 | ``` 29 | 30 | ssh: 31 | ``` 32 | git clone git@github.com:tachyons-css/css-background-size.git 33 | ``` 34 | 35 | ## Usage 36 | 37 | #### Using with [Postcss](https://github.com/postcss/postcss) 38 | 39 | Import the css module 40 | 41 | ```css 42 | @import "css-background-size"; 43 | ``` 44 | 45 | Then process the css using the [`tachyons-cli`](https://github.com/tachyons-css/tachyons-cli) 46 | 47 | ```sh 48 | $ npm i -g tachyons-cli 49 | $ tachyons path/to/css-file.css > dist/t.css 50 | ``` 51 | 52 | #### Using the css 53 | 54 | ##### CDN 55 | The easiest and most simple way to use the css is to use the cdn hosted version. Include it in the head of your html with: 56 | 57 | ``` 58 | 59 | ``` 60 | 61 | ##### Locally 62 | The built css is located in the `css` directory. It contains an unminified and minified version. 63 | You can either cut and paste that css or link to it directly in your html. 64 | 65 | ```html 66 | 67 | ``` 68 | 69 | #### Development 70 | 71 | The source css files can be found in the `src` directory. 72 | Running `$ npm start` will process the source css and place the built css in the `css` directory. 73 | 74 | ## The css 75 | 76 | ```css 77 | /* 78 | BACKGROUND SIZE 79 | */ 80 | .bg-cv { background-size: cover; } 81 | .bg-cn { background-size: contain; } 82 | .bg-quarter { background-size: 25%; } 83 | .bg-half { background-size: 50%; } 84 | .bg-three-quarters { background-size: 75%; } 85 | .bg-full { background-size: 100%; } 86 | .bg-auto { background-size: auto; } 87 | @media screen and (min-width: 48em) { 88 | .bg-cv-ns { background-size: cover; } 89 | .bg-cn-ns { background-size: contain; } 90 | .bg-quarter-ns { background-size: 25%; } 91 | .bg-half-ns { background-size: 50%; } 92 | .bg-three-quarters-ns { background-size: 75%; } 93 | .bg-full-ns { background-size: 100%; } 94 | .bg-auto-ns { background-size: auto; } 95 | } 96 | @media screen and (min-width:48em) and (max-width: 64em) { 97 | .bg-cv-m { background-size: cover; } 98 | .bg-cn-m { background-size: contain; } 99 | .bg-quarter-m { background-size: 25%; } 100 | .bg-half-m { background-size: 50%; } 101 | .bg-three-quarters-m { background-size: 75%; } 102 | .bg-full-m { background-size: 100%; } 103 | .bg-auto-m { background-size: auto; } 104 | } 105 | @media screen and (min-width: 64em) { 106 | .bg-cv-l { background-size: cover; } 107 | .bg-cn-l { background-size: contain; } 108 | .bg-quarter-l { background-size: 25%; } 109 | .bg-half-l { background-size: 50%; } 110 | .bg-three-quarters-l { background-size: 75%; } 111 | .bg-full-l { background-size: 100%; } 112 | .bg-auto-l { background-size: auto; } 113 | } 114 | ``` 115 | 116 | ## Contributing 117 | 118 | 1. Fork it 119 | 2. Create your feature branch (`git checkout -b my-new-feature`) 120 | 3. Commit your changes (`git commit -am 'Add some feature'`) 121 | 4. Push to the branch (`git push origin my-new-feature`) 122 | 5. Create new Pull Request 123 | 124 | ## Authors 125 | 126 | * [mrmrs](http://mrmrs.io) 127 | * [johno](http://johnotander.com) 128 | 129 | ## License 130 | 131 | ISC 132 | 133 | --------------------------------------------------------------------------------