Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSS is Dead; Long Live CSS

CSS is Dead; Long Live CSS

Preprocessors are everywhere, but CSS is evolving to meet our needs. Will preprocessors continue to be necessary as CSS adds more features?

Alan Mooiman

July 08, 2015
Tweet

Other Decks in Programming

Transcript

  1. Nesting .alert{ background: #f00; h1{ font-size: 3rem; } h2{ font-size:

    2rem; } } .alert{ background: #f00; } .alert h1{ font-size: 3rem; } .alert h2{ font-size: 2rem; }
  2. Nesting body { div.container { div.content { div.articles { &

    > div.post { div.title { h1 { a { color: green;
  3. Deprecation DEPRECATION WARNING on line 25 of src/css/scss/bourbon/addons/_html5-input-types.scss:
 Assigning to

    global variable "$unquoted-inputs-list" by default is deprecated.
 In future versions of Sass, this will create a new local variable.
 If you want to assign to the global variable, use "$unquoted-inputs-list: append($unquoted-inputs-list, unquote($input-type), comma) !global" instead. DEPRECATION WARNING on line 25 of src/css/scss/bourbon/addons/_html5-input-types.scss:
 Assigning to global variable "$unquoted-inputs-list" by default is deprecated.
 In future versions of Sass, this will create a new local variable.
 If you want to assign to the global variable, use "$unquoted-inputs-list: append($unquoted-inputs-list, unquote($input-type), comma) !global" instead. DEPRECATION WARNING on line 25 of src/css/scss/bourbon/addons/_html5-input-types.scss:
 Assigning to global variable "$unquoted-inputs-list" by default is deprecated.
 In future versions of Sass, this will create a new local variable.
 If you want to assign to the global variable, use "$unquoted-inputs-list: append($unquoted-inputs-list, unquote($input-type), comma) !global" instead. DEPRECATION WARNING on line 25 of src/css/scss/bourbon/addons/_html5-input-types.scss:
 Assigning to global variable "$unquoted-inputs-list" by default is deprecated.
 In future versions of Sass, this will create a new local variable.
 If you want to assign to the global variable, use "$unquoted-inputs-list: append($unquoted-inputs-list, unquote($input-type), comma) !global" instead.
  4. CSS Variables :root{ --red: 255; --green: 0; --blue: 255; }

    div{ color: rgb( var(--red), var(--green), var(--blue) ); } Some div Another div .magic{ --green: 255;} <div>Some div</div> <div class=“magic”>Another div</div>
  5. Extends .alert{ color: black; border: 1px solid red; } .alert-danger{

    @extend .alert; background: yellow; } .alert-catastrophic{ @extend .alert; background: red; } .alert, .alert-danger, .alert-catastrophic { color: black; border: 1px solid red; } .alert-danger { background: yellow; } .alert-catastrophic{ background: red; }
  6. Mixins @mixin flexbox{ display:-webkit-flex; display:-moz-flex; display:-ms-flex; display: flex; } .item-container{

    @include flexbox; } .item-container{ display:-webkit-flex; display:-moz-flex; display:-ms-flex; display: flex; }
  7. Nesting section, article, aside{ h1, h2{ color: red; } }

    section h1, article h1, aside h1, section h2, article h2, aside h2 { color: red; }
  8. CSS Extensions @custom-selector :--heading h1, h2, h3, h4, h5, h6;

    :--heading { /* styles for all headings */ } :--heading + p { /* more styles */ } Status: Super theoretical at the moment
  9. Web Components • Might solve the global scope problem •

    …eventually https://hacks.mozilla.org/2014/12/mozilla-and-web-components/
  10. HTTP/2 @import url("fineprint.css") print; @import url("bluish.css") projection, tv; @import 'custom.css';

    @import url("chrome://communicator/skin/"); @import "common.css" screen, projection; @import url('landscape.css') screen and (orientation:landscape); @import url("component-small.css") (max-width: 40em);
  11. Container queries • The holy grail of RWD • http://alistapart.com/article/container-queries-

    once-more-unto-the-breach • http://dev.w3.org/csswg/css-containment/ #contain-property