├── .gitignore ├── LICENSE ├── README.md ├── bower.json ├── csscv.scss └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | *.css 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2013 Harry Roberts 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #CSSCV 2 | 3 | **CSSCV is a simple, opinionated stylesheet for formatting semantic HTML to look 4 | like a CSS file.** 5 | 6 | ## Getting started 7 | 8 | The simplest way to get started with CSSCV is to dive right into the HTML and 9 | get editing! There is nothing in the Sass that isn’t used in the HTML, so the 10 | `index.html` file acts as a comprehensive, real-world demo of what CSSCV can do. 11 | 12 | Below is a more detailed overview of the ins-and-outs of the way CSSCV works. 13 | 14 | ## Opinionated? 15 | 16 | CSSCV matches my own personal style of writing CSS, and uses a specific colour 17 | scheme, [Solarized](http://ethanschoonover.com/solarized). Some of 18 | its other more opinionated features: 19 | 20 | * [Only single classes are allowed as selectors](http://csswizardry.com/2012/05/keep-your-css-selectors-short/) 21 | * [It uses a BEM-style naming convention](http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/) 22 | * [Rulesets are spaced by five carriage returns](https://github.com/csswizardry/CSS-Guidelines#section-titles) 23 | * [Quasi-nested rulesets are indented](https://github.com/csswizardry/CSS-Guidelines#anatomy-of-rulesets) 24 | * [All indents are four spaces](https://github.com/csswizardry/CSS-Guidelines#anatomy-of-rulesets) 25 | 26 | ## Enabling 27 | 28 | CSSCV comes with the option to [en|dis]able its styling. This is so that you can 29 | quickly and easily remove CSSCV’s unconventional look, and instead expose 30 | unstyled HTML in case you ever need to provide a more standard format of CV to 31 | recruiters or HR teams. Boring, but often vital. Enabling CSSCV is as simple as 32 | adding a class of `.csscv` the the `html` element; all of CSSCV’s styles are 33 | scoped to this namespace. 34 | 35 | ## Making stuff work 36 | 37 | There are a series of simple yet strict rules to follow in order to use CSSCV. 38 | Rulesets are built using definition lists and comments and selectors are usually 39 | constructed using headings. Below is a simple example that we will deconstruct: 40 | 41 |
188 | Foo 189 | Bar 190 | Baz 191 |
192 | 193 | ### `.notice` 194 | 195 | This is the attribution message that appears at the bottom of the CSSCV page. 196 | Including the message is not mandatory, but is appreciated. 197 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "csscv", 3 | "version": "1.1.1", 4 | "main": "csscv.scss", 5 | "author": "Harry Roberts" 6 | } 7 | -------------------------------------------------------------------------------- /csscv.scss: -------------------------------------------------------------------------------- 1 | /*------------------------------------*\ 2 | CSSCV 3 | \*------------------------------------*/ 4 | /*!* 5 | * 6 | * CSSCV -- csswizardry.com/csscv -- @csswizardry 7 | * 8 | */ 9 | /** 10 | * CSSCV is a simple, opinionated stylesheet for formatting semantic HTML to 11 | * look like a CSS file. Apply the class of `.csscv` to the `html` element of 12 | * your page to invoke the CSSCV stylesheet. Removing this class will leave you 13 | * with an unstyled page of pure, semantic HTML. This is useful if you wish to 14 | * disable CSSCV in order to style your page more suitably for recruiters and 15 | * more serious applications. 16 | */ 17 | .csscv { 18 | 19 | 20 | 21 | 22 | 23 | /*------------------------------------*\ 24 | #CONTENTS 25 | \*------------------------------------*/ 26 | /** 27 | * SETTINGS 28 | * RESET 29 | * HELPERS 30 | * BASE 31 | * RULESETS 32 | * SELECTORS 33 | * DECLARATIONS 34 | * PROPERTIES 35 | * VALUES 36 | * STRINGS 37 | * NUMBERS 38 | * URLS 39 | * LISTS 40 | * BEM 41 | * COMMENTS 42 | * NOTICE 43 | */ 44 | 45 | 46 | 47 | 48 | 49 | /*------------------------------------*\ 50 | #SETTINGS 51 | \*------------------------------------*/ 52 | /** 53 | * How big would you like your tabs to be? 54 | */ 55 | $tab-size: 4; 56 | 57 | 58 | /** 59 | * Colour settings. 60 | */ 61 | $color--blue--dark: #002935; 62 | $color--blue--light: #0083ce; 63 | $color--grey--dark: #7f9597; 64 | $color--grey--light: #4f6c73; 65 | $color--mustard: #b58a0a; 66 | $color--turquoise: #00a19b; 67 | 68 | 69 | /** 70 | * Reassign colour variables to better names. 71 | */ 72 | $color--background: $color--blue--dark; 73 | $color--text: $color--grey--light; 74 | $color--comment: $color--grey--dark; 75 | $color--selector: $color--blue--light; 76 | $color--braces: $color--blue--light; 77 | $color--property: $color--mustard; 78 | $color--value: $color--mustard; 79 | $color--colons: $color--grey--dark; 80 | $color--string: $color--turquoise; 81 | $color--number: $color--turquoise; 82 | 83 | 84 | 85 | 86 | 87 | /*------------------------------------*\ 88 | #RESET 89 | \*------------------------------------*/ 90 | /** 91 | * This is a pretty poor reset, but it will suffice for a single-page, single- 92 | * responsibility stylesheet. 93 | * 94 | * 1. Everything the same size (16px by default). 95 | * 2. Fixes an odd font-sizing issue in some browsers. 96 | */ 97 | * { 98 | margin: 0; 99 | padding: 0; 100 | font-size: 100%; /* [1] */ 101 | font-family: monospace, monospace; /* [2] */ 102 | font-weight: normal; 103 | } 104 | 105 | 106 | 107 | 108 | 109 | /*------------------------------------*\ 110 | #HELPERS 111 | \*------------------------------------*/ 112 | /** 113 | * Little helper classes to allow us to quickly build stuff. 114 | * 115 | * 1. Space apart our rulesets by the same value as our line-height. 116 | */ 117 | .spaced, 118 | %spaced { 119 | margin-bottom: 24px; /* [1] */ 120 | margin-bottom: 1.5rem; /* [1] */ 121 | } 122 | 123 | .spaced--large { 124 | margin-bottom: 5 * 24px; 125 | margin-bottom: 5 * 1.5rem; 126 | } 127 | 128 | .indented { 129 | padding-left: ($tab-size * .625) +em; 130 | } 131 | 132 | 133 | 134 | 135 | 136 | /*------------------------------------*\ 137 | #BASE 138 | \*------------------------------------*/ 139 | /** 140 | * 1. Comfortable line-height (equivalent to 24px). 141 | * 2. Pad the page by the same value as our line-height. 142 | */ 143 | & { 144 | line-height: 1.5; /* [1] */ 145 | padding: 24px; /* [2] */ 146 | padding: 1.5rem; /* [2] */ 147 | padding-bottom: 0; 148 | color: $color--text; 149 | background-color: $color--background; 150 | } 151 | 152 | a { 153 | color: inherit; 154 | } 155 | 156 | 157 | 158 | 159 | 160 | /*------------------------------------*\ 161 | #RULESETS 162 | \*------------------------------------*/ 163 | /** 164 | * Wrap our selector and declarations in an element with a class of `.ruleset`. 165 | */ 166 | .ruleset { 167 | @extend %spaced; 168 | } 169 | 170 | 171 | 172 | 173 | 174 | /*------------------------------------*\ 175 | #SELECTORS 176 | \*------------------------------------*/ 177 | /** 178 | * Each section is marked up as a heading which becomes our selector. We assume 179 | * all our selectors will be classes. 180 | * 181 | * 1. Lowercase our class names. 182 | * 2. Prepend a period. 183 | * 3. Append an opening brace. 184 | */ 185 | .selector { 186 | color: $color--selector; 187 | text-transform: lowercase; /* [1] */ 188 | 189 | &:before { 190 | content: "."; /* [2] */ 191 | } 192 | 193 | &:after { 194 | content: " {"; /* [3] */ 195 | } 196 | 197 | } 198 | 199 | /** 200 | * Insert a hyphen in place of a space in multiple word selectors. 201 | * 202 | * 1. Force the empty element to take up its space. 203 | */ 204 | .selector__delimiter { 205 | position: relative; 206 | white-space: pre; /* [1] */ 207 | 208 | &:before { 209 | content: "-"; 210 | position: absolute; 211 | display: inline-block; 212 | width: .625em; 213 | text-align: center; 214 | } 215 | 216 | } 217 | 218 | 219 | 220 | 221 | 222 | /*------------------------------------*\ 223 | #DECLARATIONS 224 | \*------------------------------------*/ 225 | /** 226 | * Each block of declarations is marked up as a definition list with a class of 227 | * `.declarations`. 228 | * 229 | * 1. Close our declarations with a curly brace. 230 | */ 231 | .declarations { 232 | 233 | &:after { 234 | content: "}"; /* [1] */ 235 | color: $color--braces; 236 | } 237 | 238 | } 239 | 240 | 241 | 242 | 243 | 244 | /*------------------------------------*\ 245 | #PROPERTIES 246 | \*------------------------------------*/ 247 | /** 248 | * A `dt` and `dd` form a property–value pair (i.e. declaration). Each `dt` gets 249 | * a class of `.property`. 250 | * 251 | * 1. Indent our declarations based on the chosen tab size. 252 | * 2. End each property with a colon and a space. 253 | */ 254 | .property { 255 | text-transform: lowercase; 256 | float: left; 257 | clear: both; 258 | padding-left: ($tab-size * .625) +em; /* [1] */ 259 | color: $color--property; 260 | 261 | &:after { 262 | content: ":\00A0"; /* [2] */ 263 | color: $color--colons; 264 | } 265 | 266 | } 267 | 268 | 269 | 270 | 271 | 272 | /*------------------------------------*\ 273 | #VALUES 274 | \*------------------------------------*/ 275 | /** 276 | * Each `dd` gets a class of `.value`. 277 | * 278 | * 1. End each value with a semi-colon. 279 | */ 280 | .value { 281 | color: $color--value; 282 | 283 | &:after { 284 | content: ";"; /* [1] */ 285 | color: $color--colons; 286 | } 287 | 288 | } 289 | 290 | 291 | 292 | 293 | 294 | /*------------------------------------*\ 295 | #STRINGS 296 | \*------------------------------------*/ 297 | /** 298 | * Strings in CSS (such as font names) need to be enclosed in quotes. Wrap 299 | * strings in your CV with a `span` with a class of `.string`, e.g. 300 | * `Harry Roberts`. 301 | */ 302 | .string { 303 | color: $color--string; 304 | 305 | &:before, 306 | &:after { 307 | content: "\""; 308 | } 309 | 310 | } 311 | 312 | 313 | 314 | 315 | 316 | /*------------------------------------*\ 317 | #NUMBERS 318 | \*------------------------------------*/ 319 | /** 320 | * Numbers in values need wrapping in a `.number` element. 321 | */ 322 | .number { 323 | color: $color--number; 324 | } 325 | 326 | 327 | 328 | 329 | 330 | /*------------------------------------*\ 331 | #URLS 332 | \*------------------------------------*/ 333 | /** 334 | * Wrap any URLs with a `span` with a class of `.url`. 335 | */ 336 | .url { 337 | 338 | &:before{ 339 | content: "url("; 340 | } 341 | 342 | &:after { 343 | content: ")"; 344 | } 345 | 346 | } 347 | 348 | 349 | 350 | 351 | 352 | /*------------------------------------*\ 353 | #LISTS 354 | \*------------------------------------*/ 355 | /** 356 | * Lists of values should be marked up with a `ul` with a class of `.value-list`. 357 | */ 358 | .value-list { 359 | list-style: none; 360 | display: inline; 361 | 362 | > li { 363 | display: inline; 364 | 365 | &:after { 366 | content: ", "; 367 | } 368 | 369 | &:last-child:after { 370 | content: ""; 371 | } 372 | 373 | } 374 | 375 | } 376 | 377 | 378 | 379 | 380 | 381 | /*------------------------------------*\ 382 | #BEM 383 | \*------------------------------------*/ 384 | /** 385 | * Denote any relationships within your CV with BEM-style naming. 386 | * 387 | * 1. An element of an item is prepended with the namespace you set (via 388 | * `data-namespace` in your markup) and two underscores. 389 | * 2. A modifier of an item is prepended with the namespace you set (via 390 | * `data-namespace` in your markup) and two hyphens. 391 | */ 392 | .element:before { 393 | content: attr(data-namespace) "__"; /* [1] */ 394 | } 395 | 396 | .modifier:before { 397 | content: attr(data-namespace) "--"; /* [2] */ 398 | } 399 | 400 | 401 | 402 | 403 | 404 | /*------------------------------------*\ 405 | #COMMENTS 406 | \*------------------------------------*/ 407 | /** 408 | * Create inline comments. 409 | */ 410 | .comment { 411 | color: $color--comment; 412 | 413 | &:before { 414 | content: "/* "; 415 | } 416 | 417 | &:after { 418 | content: " */"; 419 | } 420 | 421 | } 422 | 423 | 424 | /** 425 | * Create multi-line, DocBlock style comments. 426 | */ 427 | .comment-block { 428 | color: $color--comment; 429 | 430 | &:before, 431 | &:after { 432 | display: block; 433 | } 434 | 435 | &:before { 436 | content: "/**"; 437 | } 438 | 439 | &:after { 440 | content: "\00A0*/"; 441 | } 442 | 443 | } 444 | 445 | .comment-block__line { 446 | display: block; 447 | 448 | &:before { 449 | content: "\00A0*\00A0"; 450 | } 451 | 452 | } 453 | 454 | 455 | 456 | 457 | 458 | /*------------------------------------*\ 459 | #NOTICE 460 | \*------------------------------------*/ 461 | /** 462 | * The attribution notice that appears at the bottom of a CSSCV page. 463 | * 464 | * 1. Only display the message if CSSCV is enabled; the notice carries an inline 465 | * style of `display: none;` which will take effect once CSSCV is disabled. 466 | */ 467 | .notice { 468 | @extend %spaced; 469 | display: block !important; /* [1] */ 470 | } 471 | 472 | 473 | 474 | 475 | 476 | } //csscv 477 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |