SlideShare una empresa de Scribd logo
1 de 45
CSS:
A Slippery Slope to the Backend
Hi, I’m Kacey Coughlin
Web Developer, LinkedIn
@kaceykaso
Menu:
1.Why is CSS !important?
2.What do preprocessors do?
3.How do preprocessors make your life easier?
4.Basic Sass mixins
5.How CSS is becoming more like JS
6.Where you can learn more…
Poll: I prefer to write…
1.) HTML/CSS
2.) Javascript
3.) Neither, backend
forever!
When you think of CSS….
When you think of CSS….
“Stylesheet architecture”
“Painting with all the colors of the wind onto jagged mountains in
order to make them look like a bob Ross piece of art”
“Good CSS gives the web a better feel… bad CSS makes me /headde
sk”
“A thing that formats web pages that I totally don't understand”
“Curling into a ball and crying myself to sleep”
CSS (Cascading Style Sheet):
A language that describes how to presentation of a
document written in a markup language.
Before CSS…
*Possibly the first
website ever, still
works:
http://info.cern.ch/h
ypertext/WWW/The
Project.html
After CSS…
“All websites are responsive by default,
until we start adding styles and breaking them.”
- Ian Yates
csszengarden.com
csszengarden.com
CSS 1
1996
December
1998
May
2011
September
CSS 2
CSS 3
Font, color, background, alignment, margin, border,
padding, table
Absolute positioning, z-index, text-shadow
CSS3 === Christmas!
Element:not(thing) /* targets elements w/o thing */
Element:first-of-type /* targets the first of this type */
Element:nth-child(n) /* targets every nth child */
Element:nth-of-type(n) /* targets every nth type */
Element[foo*=“bar”] /* targets attr containing “bar” */
Element ~ Element-sibling /* targets any general sibling */
Parallax
3D Transforms
https://desandro.github.io/3dtransforms/
CSS Preprocessors
Extends CSS to use variables, operators, functions, and inheritance.
Minifies and concatenates all files into one plain CSS file.
sass-lang.com lesscss.org learnboost.github.io/stylus
$font-stack: Helvetica, sans-serif;
$primary-color: #333;
body {
font: 100% $font-stack;
color: $primary-color;
}
body {
font: 100% Helvetica, sans-serif;
color: #333;
}
Variables!
nav {
ul {
margin: 0;
padding: 0;
list-style: none;
}
li { display: inline-block; }
a {
text-decoration: none;
}
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav li {
display: inline-block;
}
nav a {
text-decoration: none;
}
Nesting!
Imports!
// _tabs.scss
.tabs {
list-style: none;
padding: 0;
}
// base.scss
@import “_tabs”;
body {
background: #a8a8a8;
}
// style.css
.tabs {
list-style: none;
padding: 0;
}
body {
background: #a8a8a8;
}
Mixins!
@mixin border-radius($radius) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
-ms-border-radius: $radius;
border-radius: $radius;
}
.box {
@include border-radius(10px);
}
.box {
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
-ms-border-radius: 10px;
border-radius: 10px;
}
Operators!
article[role="main"] {
float: left;
width: 600px / 960px * 100%;
}
article[role="main"] {
float: left;
width: 62.5%;
}
*Calc can do this, kinda :P
article[role=“main”] {
float: left;
width: calc(600px / 960px);
}
Vs.
@import ‘_tabs.less’;
@color-base: #2d5e8b;
.main-type {
font: 14px/100% Helvetica, sans-serif;
}
.class1 {
.main-type;
background-color: @color-base;
width: 100% / 2;
.class2 {
background-color: #fff;
color: @color-base;
}
}
@import ‘_tabs’;
$color-base: #2d5e8b;
@mixin main-type {
font: 14px/100% Helvetica, sans-serif;
}
.class1 {
@include main-type();
background-color: $color-base;
width: 100% / 2;
.class2 {
background-color: #fff;
color: $color-base;
}
}
Pros
Modularization
DRY
Mixins/functions
Nesting (less typing!)
Cons
All or nothing
Abstraction
Needs to be processed
File sizes can be deceiving
Can’t make live changes(?)
Sass Mixins: Prefixing
@mixin vendor-prefix($name, $argument) {
-webkit-#{$name}: #{$argument};
-ms-#{$name}: #{$argument};
-moz-#{$name}: #{$argument};
-o-#{$name}: #{$argument};
#{$name}: #{$argument};
}
p {
@include vendor-prefix(border-radius, 5px);
}
p {
-webkit-border-radius: 5px;
-ms-border-radius: 5px;
-moz-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
Sass Mixins: Typography
@mixin my-font($size: 14px) {
font-family: Helvetica, sans-serif;
font-size: $size;
font-weight: 300;
}
section {
@include my-font();
p {
@include my-font(12px);
}
}
section {
font-family: Helvetica, sans-serif;
font-size: 14px;
font-weight: 300;
}
section p {
font-family: Helvetica, sans-serif;
font-size: 12px;
font-weight: 300;
}
Sass Mixins: Breakpoints
@mixin bp-tablet {
@media only screen and (max-width: 600px) {
@content;
}
}
section {
@include bp-tablet {
width: 100%;
margin: 0;
}
}
section {
@media only screen and (max-width: 600px) {
section {
width: 100%;
margin: 0;
}
}
}
Sass Mixins: Animations
@mixin keyframes($animation-name) {
@-webkit-keyframes #{$animation-name} {
@content;
}
@-moz-keyframes #{$animation-name} {
@content;
}
@-ms-keyframes #{$animation-name} {
@content;
}
@-o-keyframes #{$animation-name} {
@content;
}
@keyframes #{$animation-name} {
@content;
}
}
@mixin animation($str) {
-webkit-animation: #{$str};
-moz-animation: #{$str};
-ms-animation: #{$str};
-o-animation: #{$str};
animation: #{$str};
}
Sass Mixins: Animations (cont.)
@include keyframes(slide-down) {
0% { opacity: 1; }
90% { opacity: 0; }
}
.element {
width: 300px;
height: 100px;
background: #eee;
@include animation('slide-down 5s 3');
}
Sass Mixins: Transitions
@mixin transition($args...) {
-webkit-transition: $args;
-moz-transition: $args;
-ms-transition: $args;
-o-transition: $args;
transition: $args;
}
a {
color: #adadad;
@include transition(color .3s ease);
&:hover {
color: #000;
}
}
a {
color: #adadad;
…
transition: color .3s ease;
&:hover {
color: #000;
}
}
Sass Mixins: Visually Hide
@mixin hide-element() {
margin: -1px;
padding: 0;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0 0 0 0);
position: absolute;
}
.hidden-element {
@include hide-element();
}
<button class="mobile-navigation-trigger">
<span class=”hide-element">
Open the navigation
</span>
<img src="img/mobile-navigation-icon.svg">
</button>
Preprocessors:
Making your life easier since 2006!
1. Less typing
2. Saves dev time
3. See 1 and 2
CSS is becoming more like Javascript…
Minifying (and compiling): CSS
html body,
html * {
font: normal 200 14px/1.5 "Helvetica Neue", "Helvetica", "Arial", sans-serif;
}
body {
background-color: #F0F3F6;
width: 100%;
}
nav.navbar,
.tools-navbar.navbar {
padding: 0 48px;
.navbar-brand {
@include typography($size: large, $style: light, $color: #fff);
letter-spacing: 1px;
}
.navbar-nav,
.navbar-nav > li a > span {
@include typography($size: small, $style: light, $color: #fff);
font-weight: 100;
letter-spacing: 1px;
line-height: 2;
}
.navbar-nav > li .dropdown-menu > li a > span {
color: #000;
}
}
html *,html body{font:normal 200
14px/1.5 "Helvetica
Neue",Helvetica,Arial,sans-
serif}body{background-
color:#F0F3F6;width:100%}.tools-
navbar.navbar,nav.navbar{padding:0
48px}
http://cssminifier.com/
Minifying (and compiling): JS
(function ($) {
/**
* @function
* @property {object} jQuery plugin which runs handler function once specified
* element is inserted into the DOM
* @param {function} handler A function to execute at the time when the
* element is inserted
* @param {bool} shouldRunHandlerOnce Optional: if true, handler is unbound
* after its first invocation
* @example $(selector).waitUntilExists(function);
*/
$.fn.waitUntilExists = function (handler, shouldRunHandlerOnce, isChild) {
var found = 'found';
var $this = $(this.selector);
var $elements = $this.not(function () {
return $(this).data(found);
}).each(handler).data(found, true);
if (!isChild) {
(window.waitUntilExists_Intervals = window.waitUntilExists_Intervals ||
{})[this.selector] =
window.setInterval(function () {
$this.waitUntilExists(handler, shouldRunHandlerOnce, true);
}, 500)
;
} else if (shouldRunHandlerOnce && $elements.length) {
window.clearInterval(window.waitUntilExists_Intervals[this.selector]);
}
return $this;
}
}(jQuery));
!function(t){t.fn.waitUntilExists=function(n,i,s){var
e="found",a=t(this.selector),l=a.not(function(){return
t(this).data(e)}).each(n).data(e,!0);return
s?i&&l.length&&window.clearInterval(window.waitUntilE
xists_Intervals[this.selector]):(window.waitUntilExists_Int
ervals=window.waitUntilExists_Intervals||{})[this.selecto
r]=window.setInterval(function(){a.waitUntilExists(n,i,!0)}
,500),a}}(jQuery);
http://jscompress.com/
Animations: JS vs CSS
$(’button').hover(function() {
$(this).animate({"color":"#efbe5c","font-size":"52pt"}, 1000); //mouseover
}, function() {
$(this).animate({"color":"#e8a010","font-size":"48pt"}, 1000); //mouseout
});
*Requires Jquery, Jquery Colors, etc
button {
transition: color 1s ease-in-out;
-moz-transition: color 1s ease-in-out;
-webkit-transition: color 1s ease-in-out;
-o-transition: color 1s ease-in-out;
}
button {
@include transition(color, 1s);
}
Animations: JS vs CSS*
Jquery and Javascript are not interchangable.
Jquery GSAP CSS
CSS does better with simpler transitions.
JS is better with complicated cubic bezier, 3D, wandering points, etc.
https://css-tricks.com/myth-busting-css-animations-vs-javascript/
http://codepen.io/GreenSock/full/2a53bbbcd47df627f25ed1b74beb407d/
Performance
CSS Jquery
• CSS only repaints
what it needs to
• CSS lets the browser
know up front
• Browser cannot
predict with JS
• JS must recalculate
all styles first, then
paint
• Produces visible lag
up front
http://css3.bradshawenterpris
es.com/blog/jquery-vs-css3-
transitions/
Functions
$columns: 4;
@for $i from 1 through $columns {
.cols-#{$i} {
width: ((100 / $columns) * $i) * 1%;
}
}
var $columns = 4;
for (var i = 0; i < $columns; i++) {
$(‘.cols-’ + i).css({
‘width’: ((100 / $columns) * i) * 1%)
});
}
CSS JS
Functions
@if lightness($color) < 50% {
text-shadow: 1px 1px 1px rgba(#fff, $opacity);
} @else {
text-shadow: -1px -1px 1px rgba(#000, $opacity);
}
color: $color;
JS
CSS
if (lightness($color) < 50%) {
this.css(‘text-shadow’,’1px 1px 1px rgba(#fff, $opacity)’);
} else {
this.css(‘text-shadow’, ‘-1px -1px 1px rgba(#000, $opacity)’);
}
this.css(‘color’, $color);
CSS: The Future!
*CSS4 Spec (Draft): https://drafts.csswg.org/selectors/
Element:matches(param1, param1) /* opposite of :not, takes multiple params */
Element:nth-match(n) /* targets nth matching sibling */
Element:has(param1, param2) /* targets element if it contains params */
Element:dir(rtl) /* targets document language direction */
Element:any-link /* targets any anchor, do not need to specify */
Element:indeterminate /* targets states not checked or unchecked*/
Element:column(thing) /* targets column of element with thing in it */
Element /foo/ Sibling /* targets sibling by element’s attr foo */
Element! > Thing /* targets thing’s parent of type element */
HTML -> CSS -> Javascript -> ???
The more you know….
Learn MOAR!
https://css-tricks.com/
http://codepen.io/
http://www.smashingmagazine.
com/
Shop Talk
http://shoptalkshow.com/
Boagworld
https://boagworld.com/show/
The Big Web Show
http://www.zeldman.com/
Category/the-big-web-show/
http://stackoverflow.com/
https://www.quora.com/
http://caniuse.com/
Thanks!!
@kaceykaso @linkedin

Más contenido relacionado

La actualidad más candente

JQuery In Rails
JQuery In RailsJQuery In Rails
JQuery In RailsLouie Zhao
 
Make your own wp cli command in 10min
Make your own wp cli command in 10minMake your own wp cli command in 10min
Make your own wp cli command in 10minIvelina Dimova
 
Play, Slick, play2-authの間で討死
Play, Slick, play2-authの間で討死Play, Slick, play2-authの間で討死
Play, Slick, play2-authの間で討死Kiwamu Okabe
 
Juicer javascript template engine
Juicer   javascript template engineJuicer   javascript template engine
Juicer javascript template enginepaulguo
 
Accelerated Native Mobile Development with the Ti gem
Accelerated Native Mobile Development with the Ti gemAccelerated Native Mobile Development with the Ti gem
Accelerated Native Mobile Development with the Ti gemWynn Netherland
 
Compass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS DeveloperCompass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS DeveloperWynn Netherland
 
Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Thinqloud
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryQConLondon2008
 
An in-depth look at jQuery
An in-depth look at jQueryAn in-depth look at jQuery
An in-depth look at jQueryPaul Bakaus
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginningAnis Ahmad
 
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...Axway Appcelerator
 

La actualidad más candente (20)

JQuery In Rails
JQuery In RailsJQuery In Rails
JQuery In Rails
 
Make your own wp cli command in 10min
Make your own wp cli command in 10minMake your own wp cli command in 10min
Make your own wp cli command in 10min
 
Play, Slick, play2-authの間で討死
Play, Slick, play2-authの間で討死Play, Slick, play2-authの間で討死
Play, Slick, play2-authの間で討死
 
Jquery introduction
Jquery introductionJquery introduction
Jquery introduction
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Juicer javascript template engine
Juicer   javascript template engineJuicer   javascript template engine
Juicer javascript template engine
 
Accelerated Native Mobile Development with the Ti gem
Accelerated Native Mobile Development with the Ti gemAccelerated Native Mobile Development with the Ti gem
Accelerated Native Mobile Development with the Ti gem
 
SQL Injection Part 2
SQL Injection Part 2SQL Injection Part 2
SQL Injection Part 2
 
Jquery-overview
Jquery-overviewJquery-overview
Jquery-overview
 
Theming and Sass
Theming and SassTheming and Sass
Theming and Sass
 
CSS3 Refresher
CSS3 RefresherCSS3 Refresher
CSS3 Refresher
 
Compass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS DeveloperCompass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS Developer
 
Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J Query
 
An in-depth look at jQuery
An in-depth look at jQueryAn in-depth look at jQuery
An in-depth look at jQuery
 
Wsomdp
WsomdpWsomdp
Wsomdp
 
Pagination in PHP
Pagination in PHPPagination in PHP
Pagination in PHP
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
 
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
 
Canvas - The Cure
Canvas - The CureCanvas - The Cure
Canvas - The Cure
 

Similar a CSS: A Slippery Slope to the Backend

Using jQuery to Extend CSS
Using jQuery to Extend CSSUsing jQuery to Extend CSS
Using jQuery to Extend CSSChris Coyier
 
Cheap frontend tricks
Cheap frontend tricksCheap frontend tricks
Cheap frontend tricksambiescent
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid PrototypingEven Wu
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & CompassRob Davarnia
 
Raleigh Web Design Meetup Group - Sass Presentation
Raleigh Web Design Meetup Group - Sass PresentationRaleigh Web Design Meetup Group - Sass Presentation
Raleigh Web Design Meetup Group - Sass PresentationDaniel Yuschick
 
SASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockSASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockMarco Pinheiro
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction SassZeeshan Ahmed
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)emrox
 
Using Sass - Building on CSS
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSSSayanee Basu
 
Styling components with JavaScript
Styling components with JavaScriptStyling components with JavaScript
Styling components with JavaScriptbensmithett
 
jQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't KnowjQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't Knowgirish82
 
Advanced sass/compass
Advanced sass/compassAdvanced sass/compass
Advanced sass/compassNick Cooley
 
Advanced Technology for Web Application Design
Advanced Technology for Web Application DesignAdvanced Technology for Web Application Design
Advanced Technology for Web Application DesignBryce Kerley
 
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Adam Darowski
 
Front-End Dev Tools
Front-End Dev ToolsFront-End Dev Tools
Front-End Dev ToolsNetguru
 
Auto tools
Auto toolsAuto tools
Auto tools祺 周
 
Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors. Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors. The University of Akron
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & CompassAndreas Dantz
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentationMario Noble
 

Similar a CSS: A Slippery Slope to the Backend (20)

Using jQuery to Extend CSS
Using jQuery to Extend CSSUsing jQuery to Extend CSS
Using jQuery to Extend CSS
 
Cheap frontend tricks
Cheap frontend tricksCheap frontend tricks
Cheap frontend tricks
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid Prototyping
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
 
Raleigh Web Design Meetup Group - Sass Presentation
Raleigh Web Design Meetup Group - Sass PresentationRaleigh Web Design Meetup Group - Sass Presentation
Raleigh Web Design Meetup Group - Sass Presentation
 
SASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockSASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, Greensock
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction Sass
 
Sencha Touch
Sencha TouchSencha Touch
Sencha Touch
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
 
Using Sass - Building on CSS
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSS
 
Styling components with JavaScript
Styling components with JavaScriptStyling components with JavaScript
Styling components with JavaScript
 
jQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't KnowjQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't Know
 
Advanced sass/compass
Advanced sass/compassAdvanced sass/compass
Advanced sass/compass
 
Advanced Technology for Web Application Design
Advanced Technology for Web Application DesignAdvanced Technology for Web Application Design
Advanced Technology for Web Application Design
 
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
 
Front-End Dev Tools
Front-End Dev ToolsFront-End Dev Tools
Front-End Dev Tools
 
Auto tools
Auto toolsAuto tools
Auto tools
 
Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors. Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors.
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & Compass
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
 

Más de FITC

Cut it up
Cut it upCut it up
Cut it upFITC
 
Designing for Digital Health
Designing for Digital HealthDesigning for Digital Health
Designing for Digital HealthFITC
 
Profiling JavaScript Performance
Profiling JavaScript PerformanceProfiling JavaScript Performance
Profiling JavaScript PerformanceFITC
 
Surviving Your Tech Stack
Surviving Your Tech StackSurviving Your Tech Stack
Surviving Your Tech StackFITC
 
How to Pitch Your First AR Project
How to Pitch Your First AR ProjectHow to Pitch Your First AR Project
How to Pitch Your First AR ProjectFITC
 
Start by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the AnswerStart by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the AnswerFITC
 
Cocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s StoryCocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s StoryFITC
 
Everyday Innovation
Everyday InnovationEveryday Innovation
Everyday InnovationFITC
 
HyperLight Websites
HyperLight WebsitesHyperLight Websites
HyperLight WebsitesFITC
 
Everything is Terrifying
Everything is TerrifyingEverything is Terrifying
Everything is TerrifyingFITC
 
Post-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future HumanPost-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future HumanFITC
 
The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)FITC
 
East of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR GameEast of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR GameFITC
 
Creating a Proactive Healthcare System
Creating a Proactive Healthcare SystemCreating a Proactive Healthcare System
Creating a Proactive Healthcare SystemFITC
 
World Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product DesignWorld Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product DesignFITC
 
The Power of Now
The Power of NowThe Power of Now
The Power of NowFITC
 
High Performance PWAs
High Performance PWAsHigh Performance PWAs
High Performance PWAsFITC
 
Rise of the JAMstack
Rise of the JAMstackRise of the JAMstack
Rise of the JAMstackFITC
 
From Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self DiscoveryFrom Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self DiscoveryFITC
 
Projects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time ForProjects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time ForFITC
 

Más de FITC (20)

Cut it up
Cut it upCut it up
Cut it up
 
Designing for Digital Health
Designing for Digital HealthDesigning for Digital Health
Designing for Digital Health
 
Profiling JavaScript Performance
Profiling JavaScript PerformanceProfiling JavaScript Performance
Profiling JavaScript Performance
 
Surviving Your Tech Stack
Surviving Your Tech StackSurviving Your Tech Stack
Surviving Your Tech Stack
 
How to Pitch Your First AR Project
How to Pitch Your First AR ProjectHow to Pitch Your First AR Project
How to Pitch Your First AR Project
 
Start by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the AnswerStart by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the Answer
 
Cocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s StoryCocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s Story
 
Everyday Innovation
Everyday InnovationEveryday Innovation
Everyday Innovation
 
HyperLight Websites
HyperLight WebsitesHyperLight Websites
HyperLight Websites
 
Everything is Terrifying
Everything is TerrifyingEverything is Terrifying
Everything is Terrifying
 
Post-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future HumanPost-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future Human
 
The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)
 
East of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR GameEast of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR Game
 
Creating a Proactive Healthcare System
Creating a Proactive Healthcare SystemCreating a Proactive Healthcare System
Creating a Proactive Healthcare System
 
World Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product DesignWorld Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product Design
 
The Power of Now
The Power of NowThe Power of Now
The Power of Now
 
High Performance PWAs
High Performance PWAsHigh Performance PWAs
High Performance PWAs
 
Rise of the JAMstack
Rise of the JAMstackRise of the JAMstack
Rise of the JAMstack
 
From Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self DiscoveryFrom Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self Discovery
 
Projects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time ForProjects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time For
 

Último

20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdfMatthew Sinclair
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirtrahman018755
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查ydyuyu
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdfMatthew Sinclair
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxgalaxypingy
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrHenryBriggs2
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftAanSulistiyo
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfJOHNBEBONYAP1
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsMonica Sydney
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...kajalverma014
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasDigicorns Technologies
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsMonica Sydney
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查ydyuyu
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptxAsmae Rabhi
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsMonica Sydney
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoilmeghakumariji156
 
Power point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria IuzzolinoPower point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria Iuzzolinonuriaiuzzolino1
 

Último (20)

20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck Microsoft
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
Power point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria IuzzolinoPower point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria Iuzzolino
 

CSS: A Slippery Slope to the Backend

  • 1. CSS: A Slippery Slope to the Backend
  • 2. Hi, I’m Kacey Coughlin Web Developer, LinkedIn @kaceykaso
  • 3. Menu: 1.Why is CSS !important? 2.What do preprocessors do? 3.How do preprocessors make your life easier? 4.Basic Sass mixins 5.How CSS is becoming more like JS 6.Where you can learn more…
  • 4. Poll: I prefer to write… 1.) HTML/CSS 2.) Javascript 3.) Neither, backend forever!
  • 5. When you think of CSS….
  • 6. When you think of CSS…. “Stylesheet architecture” “Painting with all the colors of the wind onto jagged mountains in order to make them look like a bob Ross piece of art” “Good CSS gives the web a better feel… bad CSS makes me /headde sk” “A thing that formats web pages that I totally don't understand” “Curling into a ball and crying myself to sleep”
  • 7. CSS (Cascading Style Sheet): A language that describes how to presentation of a document written in a markup language.
  • 8. Before CSS… *Possibly the first website ever, still works: http://info.cern.ch/h ypertext/WWW/The Project.html
  • 10.
  • 11. “All websites are responsive by default, until we start adding styles and breaking them.” - Ian Yates
  • 14. CSS 1 1996 December 1998 May 2011 September CSS 2 CSS 3 Font, color, background, alignment, margin, border, padding, table Absolute positioning, z-index, text-shadow
  • 15. CSS3 === Christmas! Element:not(thing) /* targets elements w/o thing */ Element:first-of-type /* targets the first of this type */ Element:nth-child(n) /* targets every nth child */ Element:nth-of-type(n) /* targets every nth type */ Element[foo*=“bar”] /* targets attr containing “bar” */ Element ~ Element-sibling /* targets any general sibling */
  • 18. CSS Preprocessors Extends CSS to use variables, operators, functions, and inheritance. Minifies and concatenates all files into one plain CSS file. sass-lang.com lesscss.org learnboost.github.io/stylus
  • 19. $font-stack: Helvetica, sans-serif; $primary-color: #333; body { font: 100% $font-stack; color: $primary-color; } body { font: 100% Helvetica, sans-serif; color: #333; } Variables!
  • 20. nav { ul { margin: 0; padding: 0; list-style: none; } li { display: inline-block; } a { text-decoration: none; } } nav ul { margin: 0; padding: 0; list-style: none; } nav li { display: inline-block; } nav a { text-decoration: none; } Nesting!
  • 21. Imports! // _tabs.scss .tabs { list-style: none; padding: 0; } // base.scss @import “_tabs”; body { background: #a8a8a8; } // style.css .tabs { list-style: none; padding: 0; } body { background: #a8a8a8; }
  • 22. Mixins! @mixin border-radius($radius) { -webkit-border-radius: $radius; -moz-border-radius: $radius; -ms-border-radius: $radius; border-radius: $radius; } .box { @include border-radius(10px); } .box { -webkit-border-radius: 10px; -moz-border-radius: 10px; -ms-border-radius: 10px; border-radius: 10px; }
  • 23. Operators! article[role="main"] { float: left; width: 600px / 960px * 100%; } article[role="main"] { float: left; width: 62.5%; } *Calc can do this, kinda :P article[role=“main”] { float: left; width: calc(600px / 960px); }
  • 24. Vs. @import ‘_tabs.less’; @color-base: #2d5e8b; .main-type { font: 14px/100% Helvetica, sans-serif; } .class1 { .main-type; background-color: @color-base; width: 100% / 2; .class2 { background-color: #fff; color: @color-base; } } @import ‘_tabs’; $color-base: #2d5e8b; @mixin main-type { font: 14px/100% Helvetica, sans-serif; } .class1 { @include main-type(); background-color: $color-base; width: 100% / 2; .class2 { background-color: #fff; color: $color-base; } }
  • 25. Pros Modularization DRY Mixins/functions Nesting (less typing!) Cons All or nothing Abstraction Needs to be processed File sizes can be deceiving Can’t make live changes(?)
  • 26. Sass Mixins: Prefixing @mixin vendor-prefix($name, $argument) { -webkit-#{$name}: #{$argument}; -ms-#{$name}: #{$argument}; -moz-#{$name}: #{$argument}; -o-#{$name}: #{$argument}; #{$name}: #{$argument}; } p { @include vendor-prefix(border-radius, 5px); } p { -webkit-border-radius: 5px; -ms-border-radius: 5px; -moz-border-radius: 5px; -o-border-radius: 5px; border-radius: 5px; }
  • 27. Sass Mixins: Typography @mixin my-font($size: 14px) { font-family: Helvetica, sans-serif; font-size: $size; font-weight: 300; } section { @include my-font(); p { @include my-font(12px); } } section { font-family: Helvetica, sans-serif; font-size: 14px; font-weight: 300; } section p { font-family: Helvetica, sans-serif; font-size: 12px; font-weight: 300; }
  • 28. Sass Mixins: Breakpoints @mixin bp-tablet { @media only screen and (max-width: 600px) { @content; } } section { @include bp-tablet { width: 100%; margin: 0; } } section { @media only screen and (max-width: 600px) { section { width: 100%; margin: 0; } } }
  • 29. Sass Mixins: Animations @mixin keyframes($animation-name) { @-webkit-keyframes #{$animation-name} { @content; } @-moz-keyframes #{$animation-name} { @content; } @-ms-keyframes #{$animation-name} { @content; } @-o-keyframes #{$animation-name} { @content; } @keyframes #{$animation-name} { @content; } } @mixin animation($str) { -webkit-animation: #{$str}; -moz-animation: #{$str}; -ms-animation: #{$str}; -o-animation: #{$str}; animation: #{$str}; }
  • 30. Sass Mixins: Animations (cont.) @include keyframes(slide-down) { 0% { opacity: 1; } 90% { opacity: 0; } } .element { width: 300px; height: 100px; background: #eee; @include animation('slide-down 5s 3'); }
  • 31. Sass Mixins: Transitions @mixin transition($args...) { -webkit-transition: $args; -moz-transition: $args; -ms-transition: $args; -o-transition: $args; transition: $args; } a { color: #adadad; @include transition(color .3s ease); &:hover { color: #000; } } a { color: #adadad; … transition: color .3s ease; &:hover { color: #000; } }
  • 32. Sass Mixins: Visually Hide @mixin hide-element() { margin: -1px; padding: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); position: absolute; } .hidden-element { @include hide-element(); } <button class="mobile-navigation-trigger"> <span class=”hide-element"> Open the navigation </span> <img src="img/mobile-navigation-icon.svg"> </button>
  • 33. Preprocessors: Making your life easier since 2006! 1. Less typing 2. Saves dev time 3. See 1 and 2
  • 34. CSS is becoming more like Javascript…
  • 35. Minifying (and compiling): CSS html body, html * { font: normal 200 14px/1.5 "Helvetica Neue", "Helvetica", "Arial", sans-serif; } body { background-color: #F0F3F6; width: 100%; } nav.navbar, .tools-navbar.navbar { padding: 0 48px; .navbar-brand { @include typography($size: large, $style: light, $color: #fff); letter-spacing: 1px; } .navbar-nav, .navbar-nav > li a > span { @include typography($size: small, $style: light, $color: #fff); font-weight: 100; letter-spacing: 1px; line-height: 2; } .navbar-nav > li .dropdown-menu > li a > span { color: #000; } } html *,html body{font:normal 200 14px/1.5 "Helvetica Neue",Helvetica,Arial,sans- serif}body{background- color:#F0F3F6;width:100%}.tools- navbar.navbar,nav.navbar{padding:0 48px} http://cssminifier.com/
  • 36. Minifying (and compiling): JS (function ($) { /** * @function * @property {object} jQuery plugin which runs handler function once specified * element is inserted into the DOM * @param {function} handler A function to execute at the time when the * element is inserted * @param {bool} shouldRunHandlerOnce Optional: if true, handler is unbound * after its first invocation * @example $(selector).waitUntilExists(function); */ $.fn.waitUntilExists = function (handler, shouldRunHandlerOnce, isChild) { var found = 'found'; var $this = $(this.selector); var $elements = $this.not(function () { return $(this).data(found); }).each(handler).data(found, true); if (!isChild) { (window.waitUntilExists_Intervals = window.waitUntilExists_Intervals || {})[this.selector] = window.setInterval(function () { $this.waitUntilExists(handler, shouldRunHandlerOnce, true); }, 500) ; } else if (shouldRunHandlerOnce && $elements.length) { window.clearInterval(window.waitUntilExists_Intervals[this.selector]); } return $this; } }(jQuery)); !function(t){t.fn.waitUntilExists=function(n,i,s){var e="found",a=t(this.selector),l=a.not(function(){return t(this).data(e)}).each(n).data(e,!0);return s?i&&l.length&&window.clearInterval(window.waitUntilE xists_Intervals[this.selector]):(window.waitUntilExists_Int ervals=window.waitUntilExists_Intervals||{})[this.selecto r]=window.setInterval(function(){a.waitUntilExists(n,i,!0)} ,500),a}}(jQuery); http://jscompress.com/
  • 37. Animations: JS vs CSS $(’button').hover(function() { $(this).animate({"color":"#efbe5c","font-size":"52pt"}, 1000); //mouseover }, function() { $(this).animate({"color":"#e8a010","font-size":"48pt"}, 1000); //mouseout }); *Requires Jquery, Jquery Colors, etc button { transition: color 1s ease-in-out; -moz-transition: color 1s ease-in-out; -webkit-transition: color 1s ease-in-out; -o-transition: color 1s ease-in-out; } button { @include transition(color, 1s); }
  • 38. Animations: JS vs CSS* Jquery and Javascript are not interchangable. Jquery GSAP CSS CSS does better with simpler transitions. JS is better with complicated cubic bezier, 3D, wandering points, etc. https://css-tricks.com/myth-busting-css-animations-vs-javascript/ http://codepen.io/GreenSock/full/2a53bbbcd47df627f25ed1b74beb407d/
  • 39. Performance CSS Jquery • CSS only repaints what it needs to • CSS lets the browser know up front • Browser cannot predict with JS • JS must recalculate all styles first, then paint • Produces visible lag up front http://css3.bradshawenterpris es.com/blog/jquery-vs-css3- transitions/
  • 40. Functions $columns: 4; @for $i from 1 through $columns { .cols-#{$i} { width: ((100 / $columns) * $i) * 1%; } } var $columns = 4; for (var i = 0; i < $columns; i++) { $(‘.cols-’ + i).css({ ‘width’: ((100 / $columns) * i) * 1%) }); } CSS JS
  • 41. Functions @if lightness($color) < 50% { text-shadow: 1px 1px 1px rgba(#fff, $opacity); } @else { text-shadow: -1px -1px 1px rgba(#000, $opacity); } color: $color; JS CSS if (lightness($color) < 50%) { this.css(‘text-shadow’,’1px 1px 1px rgba(#fff, $opacity)’); } else { this.css(‘text-shadow’, ‘-1px -1px 1px rgba(#000, $opacity)’); } this.css(‘color’, $color);
  • 42. CSS: The Future! *CSS4 Spec (Draft): https://drafts.csswg.org/selectors/ Element:matches(param1, param1) /* opposite of :not, takes multiple params */ Element:nth-match(n) /* targets nth matching sibling */ Element:has(param1, param2) /* targets element if it contains params */ Element:dir(rtl) /* targets document language direction */ Element:any-link /* targets any anchor, do not need to specify */ Element:indeterminate /* targets states not checked or unchecked*/ Element:column(thing) /* targets column of element with thing in it */ Element /foo/ Sibling /* targets sibling by element’s attr foo */ Element! > Thing /* targets thing’s parent of type element */
  • 43. HTML -> CSS -> Javascript -> ??? The more you know….
  • 44. Learn MOAR! https://css-tricks.com/ http://codepen.io/ http://www.smashingmagazine. com/ Shop Talk http://shoptalkshow.com/ Boagworld https://boagworld.com/show/ The Big Web Show http://www.zeldman.com/ Category/the-big-web-show/ http://stackoverflow.com/ https://www.quora.com/ http://caniuse.com/

Notas del editor

  1. Before CSS3, js was only way to animate (lets ignore Flash). If you didn’t know JS, you were shit out of luck! But now, we can animate with CSS, and what usually tends to be the case now, better understand and slip into JS.
  2. Yes, Javascript (pure) is still king in terms of performance, but that comes with some caviats.