SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Design responsive sites using
CSS 3 preprocessors
SASS, Compass, Less
Brad Rice
Web Designer, The University of Akron
Default viewport is 960px
<meta name="viewport"
content="width=device-width,
initial-scale=1.0">
<style media="screen" type="text/css">
@import url(/global/css/reset-min.css);
@import url(/global/css/grids-min.css);
@import url(/global/css/base-min.css);
@import url(/global/css/template.css);
@import url(/global/css/sections.css);
@import url(/global/css/navigation.css);
@import url(/global/css/scrollable_widget.css);
@import url(/global/js/tipTipv13/tipTip.css);
</style>
<link rel="stylesheet" type="text/css" href="/global/css/print.css" media="print" />
<link rel="stylesheet" type="text/css" href="/global/css/ie.css media="screen" />
<link rel="stylesheet" type="text/css" href="/global/css/site.css media="screen" />
http requests
<link rel="stylesheet"
href="//share.uakron.edu/global/includes/css/bootstrap.min.css" />
<link rel="stylesheet"
href="//share.uakron.edu/global/includes/css/main.css?d=20150421100248" />
<link rel="stylesheet" href="//share.uakron.edu/global/includes/css/print.css"
media="print" />
minimized requests
CSS preprocessor
{
.scss
}
{
.css
}
SCSS @import
@import "grids";
@import "webfonts";
@import "compass";
@import "variables";
@import "mixins";
@import "objects";
filename: _grids.scss
SCSS @import
@import "tablet";
@import "desktop";
@import "large";
@import "huge";
Use media queries at the bottom of main the sass file
Compiling SASS
From command line:
sass style.scss - prints to screen
sass style.scss ../css/style.css – prints to file
sass –-watch style.scss ../css/style.css – watches file for changes
with compass: compass watch – watches entire scss directory
uses a config.rb file for configuration of where to save file changes
Compiling SASS using Compass
Basics of Sass
Mixins
Similar sets of properties used
multiple times with small
variations
Extend
Sets of properties that
match exactly
Functions
Commonly used operations
to determine value
Variables
$basesize: 12px;
$primary-color: #00285e;
Nesting
Sass adds the ability to nest
selectors in ways you can't
do in css
Built in Functions
Sass provides it's own set of
functions
darken($primary-color, 10%)
$background-color: #ffe4c4;
$primary-color: #a52a2a;
$secondary-color: #b8860b;
$h1-size: 2.2em;
h1, h2, h3 {
color: $primary-color;
}
h1 {
font-size: $h1-size;
}
compiled css
h1, h2, h3 {
color: #a52a2a;
}
h1 {
font-size: 2.2em;
}
Variables
a {
color: #6495ed;
&:hover {
color: darken(#6495ed, 10%);
}
&:visited {
color: darken(#6495ed, 50%);
}
}
compiled css
a {
color: #6495ed;
}
a:hover {
color: #3676e8;
}
a:visited {
color: #092049;
}
Nesting & selector
@mixin text-block($f-size: 1.5em,
$l-height: 140%, $m-top: .5em,
$m-bottom: .5em) {
margin-bottom: $m-bottom;
margin-top: $m-top;
font-size: $f-size;
line-height: $l-height;
}
.test {
@include text-block;
}
compiled css
.test {
margin-bottom: .5em;
margin-top: .5em;
font-size: 1.5em;
line-height: 140%;
}
Mixins
body.test a {
color: #6495ed;
&:hover {
color: darken(#6495ed, 10%);
}
&:visited {
color: darken(#6495ed, 50%);
}
}
compiled css
body.test a {
color: #6495ed;
}
body.test a:hover {
color: #3676e8;
}
body.test a:visited {
color: #092049;
}
Use nesting to namespace
.btn-a {
background: #777;
border: 1px solid black;
font-size: 1em;
}
.btn-b {
@extend .btn-a;
background: #ff0;
}
compiled css
.btn-a, .btn-b {
background: #777;
border: 1px solid black;
font-size: 1em;
}
.btn-b {
background: #ff0;
}
Extend
@if theme == 'dark' {
background: #000;
} @else {
background: #fff;
}
@each $item in $items { <styles> }
.item {
@for $i from 1 through 3 {
&.item-#{$i} {
top: $i + 30px;
}
}
}
Also: @while < 4 { }
Directives
@elseif
@if
@each
@while,
@for
@function
When to use
Mixins
Similar sets of properties used
multiple times with small
variations
Extend
Sets of properties that
match exactly
Functions
Commonly used operations
to determine value
Operators
Mixins
+ Addition
- Subtraction
* Multiplication
/ Division
% Remainder
Equality
== Equal to
!= Not equal to
String
font: Arial + " sans-serif";
Comparison
and x and y true if both x and y are true
or x or y true if either x or y is true
not x true if x is not true
Compass http://compass-style.org/
@import 'compass';
@import 'compass/reset';
html {
@include box-sizing;
}
body {
font-size: 100%;
}
compiled css
.. reset stuff
html {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-size: 100%;
}
Media Queries
@mixin respond-to($width){
@media (min-width: $width){
@content;
}
}
div.main {
border: 1px solid #000;
@include respond-to(750px){
float: left;
width: 75%;
}
}
compiled css
div.main {
border: 1px solid #000;
}
@media (min-width: 750px) {
div.main {
float: left;
width: 75%;
}
}
Breakpoint
http://breakpoint-sass.com/
$high-tide: 500px;
.johnny-utah {
@include breakpoint($high-tide) {
content: 'Whoa.';
}
}
compiled css
@media (min-width: 500px) {
.johnny-utah {
content: 'Whoa.';
}
}
Working setup
Let's code – Vinyl vintage website
David Bowie Grateful DeadFocus
Genesis Talking HeadsTodd
Rundgren
Logo
Sass/Compass productivity
• Sass and Compass team up for maximum productivity and help you accomplish browser
compatibility
• Susy allows you to create your own grid layouts
• Bootstrap or Foundation are more complete css frameworks that help you style large sites
with lots of configurations
• SassMeister.com allows you to play with sass and evaluate frameworks that will best suit your
application
Foundation sass: http://foundation.zurb.com/docs/sass.html
Bootstrap sass: http://getbootstrap.com/getting-started/#download
Less
• Less is javascript based, so requires node.js and npm to install and run
• Less.js can be a client side processor for times you want runtime generation of css
• Less syntax is not very different from Sass. The main issue is using @ for variables instead of $
Tools for the "No command line" types
• Codekit (mac): https://incident57.com/codekit/index.html
• Cactus (mac): http://cactusformac.com/
• Mixture: http://mixture.io/
• Webstorm: https://www.jetbrains.com/webstorm/
• Scout: http://mhs.github.io/scout-app/
• Prepos: https://prepros.io/
Resources and contact info
• bradrice.com/blog
• Sass resources – http://www.bradrice.com/sass-resources
• Less resources - http://www.bradrice.com/less-resources
• Github repo - https://github.com/bradrice/vinyl
• Github repo for webstart - https://github.com/bradrice/webstart
• Twitter: @brad_rice
• Email: brad@bradrice.com

Weitere ähnliche Inhalte

Was ist angesagt?

Palestra pré processadores CSS
Palestra pré processadores CSSPalestra pré processadores CSS
Palestra pré processadores CSSJust Digital
 
Making Your Own CSS Framework
Making Your Own CSS FrameworkMaking Your Own CSS Framework
Making Your Own CSS FrameworkDan Sagisser
 
BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12ucbdrupal
 
Responsive web design
Responsive web designResponsive web design
Responsive web designSean Wolfe
 
Responsive Web Design tehnike u WordPress-u
Responsive Web Design tehnike u WordPress-uResponsive Web Design tehnike u WordPress-u
Responsive Web Design tehnike u WordPress-uIgor Benić
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & CompassRob Davarnia
 
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone developmentiPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone developmentEstelle Weyl
 
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Deepak Sharma
 
Responsive Websites
Responsive WebsitesResponsive Websites
Responsive WebsitesJoe Seifi
 
Css best practices style guide and tips
Css best practices style guide and tipsCss best practices style guide and tips
Css best practices style guide and tipsChris Love
 
3 ways-to-create-sprites-in-rails
3 ways-to-create-sprites-in-rails3 ways-to-create-sprites-in-rails
3 ways-to-create-sprites-in-railsNico Hagenburger
 
Frontend django, Django Web 前端探索
Frontend django, Django Web 前端探索Frontend django, Django Web 前端探索
Frontend django, Django Web 前端探索Tim (文昌)
 
Authoring Stylesheets with Compass & Sass
Authoring Stylesheets with Compass & SassAuthoring Stylesheets with Compass & Sass
Authoring Stylesheets with Compass & Sasschriseppstein
 
3 Steps to Make Better & Faster Frontends
3 Steps to Make Better & Faster Frontends3 Steps to Make Better & Faster Frontends
3 Steps to Make Better & Faster FrontendsNico Hagenburger
 
01 Introduction To CSS
01 Introduction To CSS01 Introduction To CSS
01 Introduction To CSScrgwbr
 
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"bentleyhoke
 

Was ist angesagt? (20)

Palestra pré processadores CSS
Palestra pré processadores CSSPalestra pré processadores CSS
Palestra pré processadores CSS
 
Making Your Own CSS Framework
Making Your Own CSS FrameworkMaking Your Own CSS Framework
Making Your Own CSS Framework
 
BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12
 
Responsive web design
Responsive web designResponsive web design
Responsive web design
 
Responsive Web Design tehnike u WordPress-u
Responsive Web Design tehnike u WordPress-uResponsive Web Design tehnike u WordPress-u
Responsive Web Design tehnike u WordPress-u
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
 
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone developmentiPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
 
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
 
Responsive Websites
Responsive WebsitesResponsive Websites
Responsive Websites
 
Css best practices style guide and tips
Css best practices style guide and tipsCss best practices style guide and tips
Css best practices style guide and tips
 
3 ways-to-create-sprites-in-rails
3 ways-to-create-sprites-in-rails3 ways-to-create-sprites-in-rails
3 ways-to-create-sprites-in-rails
 
Compass/Sass
Compass/SassCompass/Sass
Compass/Sass
 
Frontend django, Django Web 前端探索
Frontend django, Django Web 前端探索Frontend django, Django Web 前端探索
Frontend django, Django Web 前端探索
 
CSS Reset
CSS ResetCSS Reset
CSS Reset
 
Bootstrap Framework
Bootstrap Framework Bootstrap Framework
Bootstrap Framework
 
Authoring Stylesheets with Compass & Sass
Authoring Stylesheets with Compass & SassAuthoring Stylesheets with Compass & Sass
Authoring Stylesheets with Compass & Sass
 
3 Steps to Make Better & Faster Frontends
3 Steps to Make Better & Faster Frontends3 Steps to Make Better & Faster Frontends
3 Steps to Make Better & Faster Frontends
 
01 Introduction To CSS
01 Introduction To CSS01 Introduction To CSS
01 Introduction To CSS
 
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
 
Css frameworks
Css frameworksCss frameworks
Css frameworks
 

Andere mochten auch

Lessons Learned From Building Your Own CSS Framework
Lessons Learned From Building Your Own CSS FrameworkLessons Learned From Building Your Own CSS Framework
Lessons Learned From Building Your Own CSS Frameworksonniesedge
 
How to develop a CSS Framework
How to develop a CSS FrameworkHow to develop a CSS Framework
How to develop a CSS FrameworkOlivier Besson
 
Media queries and frameworks
Media queries and frameworksMedia queries and frameworks
Media queries and frameworksNicole Ryan
 
Roll Your Own CSS Framework
Roll Your Own CSS FrameworkRoll Your Own CSS Framework
Roll Your Own CSS FrameworkMike Aparicio
 
Designing an Enterprise CSS Framework is Hard, Stephanie Rewis
Designing an Enterprise CSS Framework is Hard, Stephanie RewisDesigning an Enterprise CSS Framework is Hard, Stephanie Rewis
Designing an Enterprise CSS Framework is Hard, Stephanie RewisFuture Insights
 
Seven Steps to Creating a Framework
Seven Steps to Creating a FrameworkSeven Steps to Creating a Framework
Seven Steps to Creating a FrameworkRob Philibert
 
Responsive Design & CSS Frameworks
Responsive Design & CSS FrameworksResponsive Design & CSS Frameworks
Responsive Design & CSS FrameworksG C
 

Andere mochten auch (8)

Lessons Learned From Building Your Own CSS Framework
Lessons Learned From Building Your Own CSS FrameworkLessons Learned From Building Your Own CSS Framework
Lessons Learned From Building Your Own CSS Framework
 
How to develop a CSS Framework
How to develop a CSS FrameworkHow to develop a CSS Framework
How to develop a CSS Framework
 
Media queries and frameworks
Media queries and frameworksMedia queries and frameworks
Media queries and frameworks
 
Roll Your Own CSS Framework
Roll Your Own CSS FrameworkRoll Your Own CSS Framework
Roll Your Own CSS Framework
 
Grid system introduction
Grid system introductionGrid system introduction
Grid system introduction
 
Designing an Enterprise CSS Framework is Hard, Stephanie Rewis
Designing an Enterprise CSS Framework is Hard, Stephanie RewisDesigning an Enterprise CSS Framework is Hard, Stephanie Rewis
Designing an Enterprise CSS Framework is Hard, Stephanie Rewis
 
Seven Steps to Creating a Framework
Seven Steps to Creating a FrameworkSeven Steps to Creating a Framework
Seven Steps to Creating a Framework
 
Responsive Design & CSS Frameworks
Responsive Design & CSS FrameworksResponsive Design & CSS Frameworks
Responsive Design & CSS Frameworks
 

Ähnlich wie Managing responsive websites with css preprocessors.

Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid PrototypingEven Wu
 
SASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockSASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockMarco Pinheiro
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Erin M. Kidwell
 
Using Sass - Building on CSS
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSSSayanee Basu
 
GOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for thatGOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for thatRachel Andrew
 
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
 
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
Bringing sexy back to CSS: SASS/SCSS, LESS and CompassBringing sexy back to CSS: SASS/SCSS, LESS and Compass
Bringing sexy back to CSS: SASS/SCSS, LESS and CompassClaudina Sarahe
 
Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucksTim Wright
 
Learn Sass and Compass quick
Learn Sass and Compass quickLearn Sass and Compass quick
Learn Sass and Compass quickBilly Shih
 
HTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.pptHTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.pptraghavanp4
 
It's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking ModernizrIt's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking ModernizrMichael Enslow
 
Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Startededgincvg
 
UI Design with HTML5 & CSS3
UI Design with HTML5 & CSS3UI Design with HTML5 & CSS3
UI Design with HTML5 & CSS3Shay Howe
 
GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1Heather Rock
 

Ähnlich wie Managing responsive websites with css preprocessors. (20)

Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid Prototyping
 
SASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockSASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, Greensock
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
 
Using Sass - Building on CSS
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSS
 
GOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for thatGOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for that
 
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
 
Create a landing page
Create a landing pageCreate a landing page
Create a landing page
 
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
Bringing sexy back to CSS: SASS/SCSS, LESS and CompassBringing sexy back to CSS: SASS/SCSS, LESS and Compass
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
 
Death of a Themer
Death of a ThemerDeath of a Themer
Death of a Themer
 
Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucks
 
Learn Sass and Compass quick
Learn Sass and Compass quickLearn Sass and Compass quick
Learn Sass and Compass quick
 
HTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.pptHTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.ppt
 
css.ppt
css.pptcss.ppt
css.ppt
 
css.ppt
css.pptcss.ppt
css.ppt
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Core CSS3
Core CSS3Core CSS3
Core CSS3
 
It's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking ModernizrIt's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking Modernizr
 
Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Started
 
UI Design with HTML5 & CSS3
UI Design with HTML5 & CSS3UI Design with HTML5 & CSS3
UI Design with HTML5 & CSS3
 
GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1
 

Kürzlich hochgeladen

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Kürzlich hochgeladen (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Managing responsive websites with css preprocessors.

  • 1. Design responsive sites using CSS 3 preprocessors SASS, Compass, Less Brad Rice Web Designer, The University of Akron
  • 2.
  • 5. <style media="screen" type="text/css"> @import url(/global/css/reset-min.css); @import url(/global/css/grids-min.css); @import url(/global/css/base-min.css); @import url(/global/css/template.css); @import url(/global/css/sections.css); @import url(/global/css/navigation.css); @import url(/global/css/scrollable_widget.css); @import url(/global/js/tipTipv13/tipTip.css); </style> <link rel="stylesheet" type="text/css" href="/global/css/print.css" media="print" /> <link rel="stylesheet" type="text/css" href="/global/css/ie.css media="screen" /> <link rel="stylesheet" type="text/css" href="/global/css/site.css media="screen" /> http requests
  • 6. <link rel="stylesheet" href="//share.uakron.edu/global/includes/css/bootstrap.min.css" /> <link rel="stylesheet" href="//share.uakron.edu/global/includes/css/main.css?d=20150421100248" /> <link rel="stylesheet" href="//share.uakron.edu/global/includes/css/print.css" media="print" /> minimized requests
  • 8. SCSS @import @import "grids"; @import "webfonts"; @import "compass"; @import "variables"; @import "mixins"; @import "objects"; filename: _grids.scss
  • 9. SCSS @import @import "tablet"; @import "desktop"; @import "large"; @import "huge"; Use media queries at the bottom of main the sass file
  • 10. Compiling SASS From command line: sass style.scss - prints to screen sass style.scss ../css/style.css – prints to file sass –-watch style.scss ../css/style.css – watches file for changes with compass: compass watch – watches entire scss directory uses a config.rb file for configuration of where to save file changes
  • 12. Basics of Sass Mixins Similar sets of properties used multiple times with small variations Extend Sets of properties that match exactly Functions Commonly used operations to determine value Variables $basesize: 12px; $primary-color: #00285e; Nesting Sass adds the ability to nest selectors in ways you can't do in css Built in Functions Sass provides it's own set of functions darken($primary-color, 10%)
  • 13. $background-color: #ffe4c4; $primary-color: #a52a2a; $secondary-color: #b8860b; $h1-size: 2.2em; h1, h2, h3 { color: $primary-color; } h1 { font-size: $h1-size; } compiled css h1, h2, h3 { color: #a52a2a; } h1 { font-size: 2.2em; } Variables
  • 14. a { color: #6495ed; &:hover { color: darken(#6495ed, 10%); } &:visited { color: darken(#6495ed, 50%); } } compiled css a { color: #6495ed; } a:hover { color: #3676e8; } a:visited { color: #092049; } Nesting & selector
  • 15. @mixin text-block($f-size: 1.5em, $l-height: 140%, $m-top: .5em, $m-bottom: .5em) { margin-bottom: $m-bottom; margin-top: $m-top; font-size: $f-size; line-height: $l-height; } .test { @include text-block; } compiled css .test { margin-bottom: .5em; margin-top: .5em; font-size: 1.5em; line-height: 140%; } Mixins
  • 16. body.test a { color: #6495ed; &:hover { color: darken(#6495ed, 10%); } &:visited { color: darken(#6495ed, 50%); } } compiled css body.test a { color: #6495ed; } body.test a:hover { color: #3676e8; } body.test a:visited { color: #092049; } Use nesting to namespace
  • 17. .btn-a { background: #777; border: 1px solid black; font-size: 1em; } .btn-b { @extend .btn-a; background: #ff0; } compiled css .btn-a, .btn-b { background: #777; border: 1px solid black; font-size: 1em; } .btn-b { background: #ff0; } Extend
  • 18. @if theme == 'dark' { background: #000; } @else { background: #fff; } @each $item in $items { <styles> } .item { @for $i from 1 through 3 { &.item-#{$i} { top: $i + 30px; } } } Also: @while < 4 { } Directives @elseif @if @each @while, @for @function
  • 19. When to use Mixins Similar sets of properties used multiple times with small variations Extend Sets of properties that match exactly Functions Commonly used operations to determine value
  • 20. Operators Mixins + Addition - Subtraction * Multiplication / Division % Remainder Equality == Equal to != Not equal to String font: Arial + " sans-serif"; Comparison and x and y true if both x and y are true or x or y true if either x or y is true not x true if x is not true
  • 21. Compass http://compass-style.org/ @import 'compass'; @import 'compass/reset'; html { @include box-sizing; } body { font-size: 100%; } compiled css .. reset stuff html { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } body { font-size: 100%; }
  • 22. Media Queries @mixin respond-to($width){ @media (min-width: $width){ @content; } } div.main { border: 1px solid #000; @include respond-to(750px){ float: left; width: 75%; } } compiled css div.main { border: 1px solid #000; } @media (min-width: 750px) { div.main { float: left; width: 75%; } }
  • 23. Breakpoint http://breakpoint-sass.com/ $high-tide: 500px; .johnny-utah { @include breakpoint($high-tide) { content: 'Whoa.'; } } compiled css @media (min-width: 500px) { .johnny-utah { content: 'Whoa.'; } }
  • 25. Let's code – Vinyl vintage website David Bowie Grateful DeadFocus Genesis Talking HeadsTodd Rundgren Logo
  • 26. Sass/Compass productivity • Sass and Compass team up for maximum productivity and help you accomplish browser compatibility • Susy allows you to create your own grid layouts • Bootstrap or Foundation are more complete css frameworks that help you style large sites with lots of configurations • SassMeister.com allows you to play with sass and evaluate frameworks that will best suit your application Foundation sass: http://foundation.zurb.com/docs/sass.html Bootstrap sass: http://getbootstrap.com/getting-started/#download
  • 27. Less • Less is javascript based, so requires node.js and npm to install and run • Less.js can be a client side processor for times you want runtime generation of css • Less syntax is not very different from Sass. The main issue is using @ for variables instead of $
  • 28. Tools for the "No command line" types • Codekit (mac): https://incident57.com/codekit/index.html • Cactus (mac): http://cactusformac.com/ • Mixture: http://mixture.io/ • Webstorm: https://www.jetbrains.com/webstorm/ • Scout: http://mhs.github.io/scout-app/ • Prepos: https://prepros.io/
  • 29. Resources and contact info • bradrice.com/blog • Sass resources – http://www.bradrice.com/sass-resources • Less resources - http://www.bradrice.com/less-resources • Github repo - https://github.com/bradrice/vinyl • Github repo for webstart - https://github.com/bradrice/webstart • Twitter: @brad_rice • Email: brad@bradrice.com

Hinweis der Redaktion

  1. The viewport dilemma. Standard mobile web devices have different widths and heights.
  2. ----- Meeting Notes (5/5/15 10:17) ----- The meta viewport allows for mobile web browsers to display in their native device width.
  3. ----- Meeting Notes (5/5/15 10:17) ----- The previous University of Akron web template used multiple css.
  4. Using SASS with imports this is reduced to 3 files.
  5. All three are similar. I usually start with mixins and eventually extend or function will reveal itself to me as a better option along the way.
  6. Use nesting to namespace for template changes.
  7. image replacement placeholder for insterting css image in an element https://gist.github.com/bradrice/8384673a125b747aa91e
  8. All three are similar. I usually start with mixins and eventually extend or function will reveal itself to me as a better option along the way.
  9. Operators for sass for use in mixins and functions
  10. http://sassmeister.com/gist/b744de64ca243fb75b8e
  11. http://sassmeister.com/gist/9c503d3e28eee0771b4d
  12. http://breakpoint-sass.com/
  13. Switch to WebStorm and open Vinyl project
  14. Switch to WebStorm and open Vinyl project
  15. http://breakpoint-sass.com/
  16. http://breakpoint-sass.com/