SlideShare a Scribd company logo
TACTICAL
HTML & CSS
Shay Howe
@shayhowe
learn.shayhowe.com
MODULAR
HTML & CSS
WORKSHOP
@shayhoweModular HTML & CSS
Shay Howe
@shayhowe
learn.shayhowe.com
@shayhoweModular HTML & CSS
1. The Problem
2. Groundwork
3. Assembling Layout
4. Accommodating Content
5. Onward
OUR SCHEDULE
@shayhoweModular HTML & CSS
THE
PROBLEM
The Gust by Willem van de Velde the Younger
@shayhoweModular HTML & CSS
COMMON PROBLEMS
• Websites have difficulty scaling
• Code becomes brittle
• Files and code bases begin to swell
@shayhoweModular HTML & CSS
WHAT’S WRONG
• Best practices aren’t exactly best practices
• Standards need to evolve
@shayhoweModular HTML & CSS
BEST BAD PRACTICES
• Avoid extra elements
• Avoid classes
• Leverage type selectors
• Leverage descendent selectors
@shayhoweModular HTML & CSS
BEST BAD PRACTICES
Avoiding classes
section	
  ul#nav	
  li	
  {...}
section:nth-­‐child(2)	
  div:nth-­‐child(7)	
  >	
  a	
  {...}
Leveraging selectors
a.btn	
  {...}
#main	
  a.btn	
  {...}
#main	
  div.feature	
  a.btn	
  {...}
@shayhoweModular HTML & CSS
BEST BAD PRACTICES
Bad
#contact	
  li:nth-­‐child(1)	
  input,
#contact	
  li:nth-­‐child(2)	
  input	
  {
	
  	
  width:	
  160px;
}
#contact	
  li:nth-­‐child(3)	
  textarea	
  {
	
  	
  width:	
  280px;
}
@shayhoweModular HTML & CSS
BEST BAD PRACTICES
Good
.col-­‐1	
  {
	
  	
  width:	
  160px;
}
.col-­‐2	
  {
	
  	
  width:	
  280px;
}
@shayhoweModular HTML & CSS
SPECIFICITY?
• Specificity determines which styles are applied
• Each selector has a specificity weight
• High specificity beats low specificity
• Low specificity is key
@shayhoweModular HTML & CSS
MEASURING SPECIFICITY
Formula
• IDs, Classes/Pseudo-classes/Attributes, Elements
High Specificity (Bad)
#primary	
  #main	
  div.gallery	
  figure.media
IDs: 2, Classes: 2, Elements: 2 — Compiled: 2–2–2
Low Specificity (Good)
.gallery-­‐media
IDs: 0, Classes: 1, Elements: 0 — Compiled: 0–1–0
@shayhoweModular HTML & CSS
@shayhoweModular HTML & CSS
WATCH SPECIFICITY
• Be explicit
• Keep specificity low
• Never use IDs or !important
• Avoid nested selectors (#main	
  .spotlight	
  strong	
  span)
@shayhoweModular HTML & CSS
WATCH SPECIFICITY
Bad
#primary	
  #main	
  div.gallery	
  {
	
  	
  text-­‐transform:	
  uppercase;
}
#primary	
  #main	
  div.gallery	
  figure.media	
  {
	
  	
  background:	
  #ccc;
}
@shayhoweModular HTML & CSS
WATCH SPECIFICITY
Good
.gallery	
  {
	
  	
  text-­‐transform:	
  uppercase;
}
.gallery-­‐media	
  {
	
  	
  background:	
  #ccc;
}
Parade of the Black Sea Fleet by Ivan Aivazovsky
@shayhoweModular HTML & CSS
MAINTAINABILITY
Code must be...
• Organized
• Modular
• Performant
@shayhoweModular HTML & CSS
METHODOLOGIES
OOCSS
• Object-Oriented CSS
From Nicole Sullivan – oocss.org
SMACSS
• Scalable and Modular Architecture for CSS
From Jonathan Snook – smacss.com
@shayhoweModular HTML & CSS
GROUNDWORK
@shayhoweModular HTML & CSS
REUSE CODE
• Do not duplicate code
• Remove old code
• Defer loading subsequent styles
@shayhoweModular HTML & CSS
REUSE CODE
Bad
.news	
  {
	
  	
  background:	
  #eee;
	
  	
  color:	
  #666;
}
.social	
  {
	
  	
  background:	
  #eee;
	
  	
  color:	
  #666;
}
@shayhoweModular HTML & CSS
REUSE CODE
Good
.news,
.social	
  {
	
  	
  background:	
  #eee;
	
  	
  color:	
  #666;
}
Better
.feat-­‐box	
  {
	
  	
  background:	
  #eee;
	
  	
  color:	
  #666;
}
@shayhoweModular HTML & CSS
USE CLASSES
• Write understandable class names
• Avoid unnecessary nesting
• Use same strength specificity
@shayhoweModular HTML & CSS
USE CLASSES
Bad
.feat-­‐box	
  .callout	
  .pr	
  {
	
  	
  font-­‐size:	
  12px;
}
.feat-­‐box	
  .callout	
  .pr	
  .un	
  {
	
  	
  color:	
  #39f;
}
@shayhoweModular HTML & CSS
USE CLASSES
Good
.feat-­‐box	
  .price	
  {
	
  	
  font-­‐size:	
  12px;
}
.feat-­‐box	
  .unit	
  {
	
  	
  color:	
  #39f;
}
@shayhoweModular HTML & CSS
USE CLASSES
Bad
.btn.large	
  {
	
  	
  font-­‐size:	
  24px;	
  	
  
	
  	
  padding:	
  15px	
  30px;
}
<div	
  class="btn	
  large">...</div>
@shayhoweModular HTML & CSS
USE CLASSES
Good
.btn-­‐large	
  {
	
  	
  font-­‐size:	
  24px;
	
  	
  padding:	
  15px	
  30px;
}
<div	
  class="btn-­‐large">...</div>
@shayhoweModular HTML & CSS
ASSEMBLING
LAYOUT
@shayhoweModular HTML & CSS
ABSTRACT STRUCTURE
• Separate presentation (or theme) from layout
• Create an object layer for layout
• Create a skin layer for theme
• Use a grid
@shayhoweModular HTML & CSS
ABSTRACT STRUCTURE
Bad
.news	
  {
	
  	
  background:	
  #eee;
	
  	
  color:	
  #666;
	
  	
  margin:	
  0	
  10px;
	
  	
  width:	
  400px;
}
<div	
  class="news">...</div>
@shayhoweModular HTML & CSS
ABSTRACT STRUCTURE
Good
.grid-­‐4	
  {
	
  	
  margin:	
  0	
  10px;
	
  	
  width:	
  400px;
}
.feat-­‐box	
  {
	
  	
  background:	
  #eee;
	
  	
  color:	
  #666;
}
<div	
  class="grid-­‐4	
  feat-­‐box">...</div>
@shayhoweModular HTML & CSS
TRANSPARENTIZE ELEMENTS
• Stylize elements to be transparent
• Keep visual properties apart from layout
properties
@shayhoweModular HTML & CSS
TRANSPARENTIZE ELEMENTS
Bad
.pagination	
  {
	
  	
  border-­‐radius:	
  5px;
	
  	
  border:	
  1px	
  solid	
  #eee;
	
  	
  margin:	
  0	
  10px;
	
  	
  width:	
  620px;
}
<ul	
  class="pagination">...</ul>
@shayhoweModular HTML & CSS
TRANSPARENTIZE ELEMENTS
Good
.grid-­‐8	
  {
	
  	
  margin:	
  0	
  10px;
	
  	
  width:	
  620px;
}
.offset-­‐box	
  {
	
  	
  border-­‐radius:	
  5px;
	
  	
  border:	
  1px	
  solid	
  #eee;
}
<ul	
  class="grid-­‐8	
  offset-­‐box">...</ul>
@shayhoweModular HTML & CSS
CREATE ADAPTABLE LAYOUTS
• Height and width should be flexible
• Height should extend with content
• Width should extend with a grid
@shayhoweModular HTML & CSS
CREATE ADAPTABLE LAYOUTS
Bad
#main	
  {
	
  	
  float:	
  left;
	
  	
  margin:	
  0	
  10px;
	
  	
  width:	
  620px;
}
#aside	
  {
	
  	
  float:	
  left;
	
  	
  margin:	
  0	
  10px;
	
  	
  width:	
  300px;
}
@shayhoweModular HTML & CSS
CREATE ADAPTABLE LAYOUTS
Good
.grid-­‐4,
.grid-­‐8	
  {
	
  	
  float:	
  left;
	
  	
  margin:	
  0	
  10px;
}
.grid-­‐4	
  {
	
  	
  width:	
  300px;
}
.grid-­‐8	
  {
	
  	
  width:	
  620px;
}
@shayhoweModular HTML & CSS
ASSEMBLING LAYOUT
IN PRACTICE
http://bit.ly/modular-html-css
@shayhoweModular HTML & CSS
ACCOMMODATING
CONTENT
@shayhoweModular HTML & CSS
SEPARATE CONTENT
• Separate content from container
• Stylize content regardless of container
@shayhoweModular HTML & CSS
SEPARATE CONTENT
Bad
.alert	
  {
	
  	
  background:	
  #f2dede;
	
  	
  border-­‐radius:	
  10px;
	
  	
  color:	
  #b94a48;
	
  	
  padding:	
  10px	
  20px;
}
<div	
  class="alert">...</div>
@shayhoweModular HTML & CSS
SEPARATE CONTENT
Good
.alert	
  {
	
  	
  border-­‐radius:	
  10px;
	
  	
  padding:	
  10px	
  20px;
}
.alert-­‐error	
  {
	
  	
  background:	
  #f2dede;
	
  	
  color:	
  #b94a48;
}
<div	
  class="alert	
  alert-­‐error">...</div>
@shayhoweModular HTML & CSS
AVOID PARENT DEPENDENCY
• Remove parent container dependency
• Decouple CSS from HTML
• Create components to be used anywhere
@shayhoweModular HTML & CSS
AVOID PARENT DEPENDENCY
Bad
.feat-­‐box	
  {
	
  	
  background:	
  #eee;
}
article	
  .feat-­‐box	
  {
	
  	
  background:	
  #fff;
}
<article>
	
  	
  <div	
  class="feat-­‐box">...</div>
</article>
@shayhoweModular HTML & CSS
AVOID PARENT DEPENDENCY
Good
.feat-­‐box	
  {
	
  	
  background:	
  #eee;
}
.feat-­‐box-­‐alt	
  {
	
  	
  background:	
  #fff;
}
<article>
	
  	
  <div	
  class="feat-­‐box-­‐alt">...</div>
</article>
@shayhoweModular HTML & CSS
FAVOR SEMANTICS
• Allow elements to adapt
• Uses individual classes to extend modules
@shayhoweModular HTML & CSS
FAVOR SEMANTICS
Bad
.feat-­‐box	
  h2	
  {
	
  	
  color:	
  #f60;
	
  	
  font:	
  18px	
  Helvetica,	
  sans-­‐serif;
}
<div	
  class="feat-­‐box">
	
  	
  <h2>...</h2>
</div>
@shayhoweModular HTML & CSS
FAVOR SEMANTICS
Good
.feat-­‐subhead	
  {
	
  	
  color:	
  #f60;
	
  	
  font:	
  18px	
  Helvetica,	
  sans-­‐serif;
}
<div	
  class="feat-­‐box">
	
  	
  <h2	
  class="feat-­‐subhead">...</h2>
</div>
@shayhoweModular HTML & CSS
ACCOMMODATING CONTENT
IN PRACTICE
http://bit.ly/modular-html-css
@shayhoweModular HTML & CSS
ONWARD
Ships on the Roadstead by Willem van de Velde the Younger
@shayhoweModular HTML & CSS
APPROACH
• Stop thinking about pages
• Start thinking about components
• Take visual inventory
@shayhoweModular HTML & CSS
THEMES
• Decouple HTML and CSS
• Separate presentation from layout
• Separate content from container
• Extend elements with classes
@shayhoweModular HTML & CSS
OUTCOMES
• Maintainability!
• Reusable code, less duplication
• Flexibility and extensibility
• Improved standards
@shayhoweModular HTML & CSS
WHAT’S NEXT
Build a styleguide
• Twitter Bootstrap, Zurb Foundation
Review methodologies
• OOCSS, SMACSS
Test your code
• CSS Lint, Inspector, PageSpeed
@shayhoweModular HTML & CSS
THANK YOU!
Questions?
@shayhowe
http://learn.shayhowe.com

More Related Content

What's hot (20)

Rapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with BootstrapRapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with Bootstrap
Josh Jeffryes
 
Code &amp; design your first website (3:16)
Code &amp; design your first website (3:16)Code &amp; design your first website (3:16)
Code &amp; design your first website (3:16)
Thinkful
 
Web 102 INtro to CSS
Web 102  INtro to CSSWeb 102  INtro to CSS
Web 102 INtro to CSS
Hawkman Academy
 
HTML5, just another presentation :)
HTML5, just another presentation :)HTML5, just another presentation :)
HTML5, just another presentation :)
François Massart
 
Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3
Todd Zaki Warfel
 
Code & Design your first website 4/18
Code & Design your first website 4/18Code & Design your first website 4/18
Code & Design your first website 4/18
TJ Stalcup
 
Html5 public
Html5 publicHtml5 public
Html5 public
doodlemoonch
 
CSS Frameworks
CSS FrameworksCSS Frameworks
CSS Frameworks
Mike Crabb
 
Blog HTML example for IML 295
Blog HTML example for IML 295Blog HTML example for IML 295
Blog HTML example for IML 295
Evan Hughes
 
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Deepak Sharma
 
The Future Of CSS
The Future Of CSSThe Future Of CSS
The Future Of CSS
Andy Budd
 
CSS pattern libraries
CSS pattern librariesCSS pattern libraries
CSS pattern libraries
Russ Weakley
 
Advanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & EfficiencyAdvanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & Efficiency
Denise Jacobs
 
Html5 ux london
Html5 ux londonHtml5 ux london
Html5 ux london
Todd Zaki Warfel
 
Progressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQueryProgressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQuery
Todd Zaki Warfel
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
Russ Weakley
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
Terry Ryan
 
Quality Development with CSS3
Quality Development with CSS3Quality Development with CSS3
Quality Development with CSS3
Shay Howe
 
Intro to CSS
Intro to CSSIntro to CSS
Intro to CSS
Randy Oest II
 
HTML/CSS Web Blog Example
HTML/CSS Web Blog ExampleHTML/CSS Web Blog Example
HTML/CSS Web Blog Example
Michael Bodie
 
Rapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with BootstrapRapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with Bootstrap
Josh Jeffryes
 
Code &amp; design your first website (3:16)
Code &amp; design your first website (3:16)Code &amp; design your first website (3:16)
Code &amp; design your first website (3:16)
Thinkful
 
HTML5, just another presentation :)
HTML5, just another presentation :)HTML5, just another presentation :)
HTML5, just another presentation :)
François Massart
 
Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3
Todd Zaki Warfel
 
Code & Design your first website 4/18
Code & Design your first website 4/18Code & Design your first website 4/18
Code & Design your first website 4/18
TJ Stalcup
 
CSS Frameworks
CSS FrameworksCSS Frameworks
CSS Frameworks
Mike Crabb
 
Blog HTML example for IML 295
Blog HTML example for IML 295Blog HTML example for IML 295
Blog HTML example for IML 295
Evan Hughes
 
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Deepak Sharma
 
The Future Of CSS
The Future Of CSSThe Future Of CSS
The Future Of CSS
Andy Budd
 
CSS pattern libraries
CSS pattern librariesCSS pattern libraries
CSS pattern libraries
Russ Weakley
 
Advanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & EfficiencyAdvanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & Efficiency
Denise Jacobs
 
Progressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQueryProgressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQuery
Todd Zaki Warfel
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
Russ Weakley
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
Terry Ryan
 
Quality Development with CSS3
Quality Development with CSS3Quality Development with CSS3
Quality Development with CSS3
Shay Howe
 
HTML/CSS Web Blog Example
HTML/CSS Web Blog ExampleHTML/CSS Web Blog Example
HTML/CSS Web Blog Example
Michael Bodie
 

Similar to Modular HTML & CSS Workshop (20)

Modular HTML & CSS Turbo Workshop
Modular HTML & CSS Turbo WorkshopModular HTML & CSS Turbo Workshop
Modular HTML & CSS Turbo Workshop
Shay Howe
 
Css methods architecture
Css methods architectureCss methods architecture
Css methods architecture
Lasha Sumbadze
 
Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS Tricks
Andolasoft Inc
 
Rock Solid CSS Architecture
Rock Solid CSS ArchitectureRock Solid CSS Architecture
Rock Solid CSS Architecture
John Need
 
What is Modular CSS?
What is Modular CSS?What is Modular CSS?
What is Modular CSS?
Scott Vandehey
 
What is Object Oriented CSS?
What is Object Oriented CSS?What is Object Oriented CSS?
What is Object Oriented CSS?
Nicole Sullivan
 
Creative Web 02 - HTML & CSS Basics
Creative Web 02 - HTML & CSS BasicsCreative Web 02 - HTML & CSS Basics
Creative Web 02 - HTML & CSS Basics
Lukas Oppermann
 
Guidelines HTML5 & CSS3 - Atlogys (2018)
Guidelines HTML5 & CSS3 - Atlogys (2018)Guidelines HTML5 & CSS3 - Atlogys (2018)
Guidelines HTML5 & CSS3 - Atlogys (2018)
Atlogys Technical Consulting
 
CSS Architecture: Writing Maintainable CSS
CSS Architecture: Writing Maintainable CSSCSS Architecture: Writing Maintainable CSS
CSS Architecture: Writing Maintainable CSS
Alexei Skachykhin
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
Mario Hernandez
 
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective,  Ajax ...The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective,  Ajax ...
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...
Nicole Sullivan
 
Make Css easy(part:2) : easy tips for css(part:2)
Make Css easy(part:2) : easy tips for css(part:2)Make Css easy(part:2) : easy tips for css(part:2)
Make Css easy(part:2) : easy tips for css(part:2)
shabab shihan
 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
William Myers
 
Jonathan Snook - Falling to pieces: the componentization of the web
Jonathan Snook - Falling to pieces: the componentization of the webJonathan Snook - Falling to pieces: the componentization of the web
Jonathan Snook - Falling to pieces: the componentization of the web
Turing Fest
 
Teams, styles and scalable applications
Teams, styles and scalable applicationsTeams, styles and scalable applications
Teams, styles and scalable applications
Vittorio Vittori
 
Evolution of CSS
Evolution of CSSEvolution of CSS
Evolution of CSS
Ecaterina Moraru (Valica)
 
Web design-workflow
Web design-workflowWeb design-workflow
Web design-workflow
Peter Kaizer
 
Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014
Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014
Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014
Christian Lilley
 
The Fast And The Fabulous
The Fast And The FabulousThe Fast And The Fabulous
The Fast And The Fabulous
Nicole Sullivan
 
CSS Walktrough Internship Course
CSS Walktrough Internship CourseCSS Walktrough Internship Course
CSS Walktrough Internship Course
Zoltan Iszlai
 
Modular HTML & CSS Turbo Workshop
Modular HTML & CSS Turbo WorkshopModular HTML & CSS Turbo Workshop
Modular HTML & CSS Turbo Workshop
Shay Howe
 
Css methods architecture
Css methods architectureCss methods architecture
Css methods architecture
Lasha Sumbadze
 
Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS Tricks
Andolasoft Inc
 
Rock Solid CSS Architecture
Rock Solid CSS ArchitectureRock Solid CSS Architecture
Rock Solid CSS Architecture
John Need
 
What is Object Oriented CSS?
What is Object Oriented CSS?What is Object Oriented CSS?
What is Object Oriented CSS?
Nicole Sullivan
 
Creative Web 02 - HTML & CSS Basics
Creative Web 02 - HTML & CSS BasicsCreative Web 02 - HTML & CSS Basics
Creative Web 02 - HTML & CSS Basics
Lukas Oppermann
 
CSS Architecture: Writing Maintainable CSS
CSS Architecture: Writing Maintainable CSSCSS Architecture: Writing Maintainable CSS
CSS Architecture: Writing Maintainable CSS
Alexei Skachykhin
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
Mario Hernandez
 
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective,  Ajax ...The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective,  Ajax ...
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...
Nicole Sullivan
 
Make Css easy(part:2) : easy tips for css(part:2)
Make Css easy(part:2) : easy tips for css(part:2)Make Css easy(part:2) : easy tips for css(part:2)
Make Css easy(part:2) : easy tips for css(part:2)
shabab shihan
 
Jonathan Snook - Falling to pieces: the componentization of the web
Jonathan Snook - Falling to pieces: the componentization of the webJonathan Snook - Falling to pieces: the componentization of the web
Jonathan Snook - Falling to pieces: the componentization of the web
Turing Fest
 
Teams, styles and scalable applications
Teams, styles and scalable applicationsTeams, styles and scalable applications
Teams, styles and scalable applications
Vittorio Vittori
 
Web design-workflow
Web design-workflowWeb design-workflow
Web design-workflow
Peter Kaizer
 
Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014
Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014
Scalable CSS You and Your Back-End Coders Can Love - @CSSConf Asia 2014
Christian Lilley
 
The Fast And The Fabulous
The Fast And The FabulousThe Fast And The Fabulous
The Fast And The Fabulous
Nicole Sullivan
 
CSS Walktrough Internship Course
CSS Walktrough Internship CourseCSS Walktrough Internship Course
CSS Walktrough Internship Course
Zoltan Iszlai
 
Ad

More from Shay Howe (9)

Yes, Designer, You CAN Be a Product Leader
Yes, Designer, You CAN Be a Product LeaderYes, Designer, You CAN Be a Product Leader
Yes, Designer, You CAN Be a Product Leader
Shay Howe
 
Collaboration Practices
Collaboration PracticesCollaboration Practices
Collaboration Practices
Shay Howe
 
How Constraints Cultivate Growth
How Constraints Cultivate GrowthHow Constraints Cultivate Growth
How Constraints Cultivate Growth
Shay Howe
 
UI Design with HTML5 & CSS3
UI Design with HTML5 & CSS3UI Design with HTML5 & CSS3
UI Design with HTML5 & CSS3
Shay Howe
 
HTML5 Semantics
HTML5 SemanticsHTML5 Semantics
HTML5 Semantics
Shay Howe
 
An Intro to HTML & CSS
An Intro to HTML & CSSAn Intro to HTML & CSS
An Intro to HTML & CSS
Shay Howe
 
Quality Development with HTML5
Quality Development with HTML5Quality Development with HTML5
Quality Development with HTML5
Shay Howe
 
The Web Design Process: A Strategy for Success
The Web Design Process: A Strategy for SuccessThe Web Design Process: A Strategy for Success
The Web Design Process: A Strategy for Success
Shay Howe
 
Writing for the Web: The Right Strategy
Writing for the Web: The Right StrategyWriting for the Web: The Right Strategy
Writing for the Web: The Right Strategy
Shay Howe
 
Yes, Designer, You CAN Be a Product Leader
Yes, Designer, You CAN Be a Product LeaderYes, Designer, You CAN Be a Product Leader
Yes, Designer, You CAN Be a Product Leader
Shay Howe
 
Collaboration Practices
Collaboration PracticesCollaboration Practices
Collaboration Practices
Shay Howe
 
How Constraints Cultivate Growth
How Constraints Cultivate GrowthHow Constraints Cultivate Growth
How Constraints Cultivate Growth
Shay Howe
 
UI Design with HTML5 & CSS3
UI Design with HTML5 & CSS3UI Design with HTML5 & CSS3
UI Design with HTML5 & CSS3
Shay Howe
 
HTML5 Semantics
HTML5 SemanticsHTML5 Semantics
HTML5 Semantics
Shay Howe
 
An Intro to HTML & CSS
An Intro to HTML & CSSAn Intro to HTML & CSS
An Intro to HTML & CSS
Shay Howe
 
Quality Development with HTML5
Quality Development with HTML5Quality Development with HTML5
Quality Development with HTML5
Shay Howe
 
The Web Design Process: A Strategy for Success
The Web Design Process: A Strategy for SuccessThe Web Design Process: A Strategy for Success
The Web Design Process: A Strategy for Success
Shay Howe
 
Writing for the Web: The Right Strategy
Writing for the Web: The Right StrategyWriting for the Web: The Right Strategy
Writing for the Web: The Right Strategy
Shay Howe
 
Ad

Recently uploaded (20)

Grade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptx
Grade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptx
Grade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptx
MaKristinaBuenaventu1
 
最新版美国北密歇根大学毕业证(NMU毕业证书)原版定制
最新版美国北密歇根大学毕业证(NMU毕业证书)原版定制最新版美国北密歇根大学毕业证(NMU毕业证书)原版定制
最新版美国北密歇根大学毕业证(NMU毕业证书)原版定制
Taqyea
 
Austin TX Connecting Neighborhoods Presentation
Austin TX Connecting Neighborhoods PresentationAustin TX Connecting Neighborhoods Presentation
Austin TX Connecting Neighborhoods Presentation
American Institute of Architects
 
最新版西班牙拉蒙鲁尔大学毕业证(URL毕业证书)原版定制
最新版西班牙拉蒙鲁尔大学毕业证(URL毕业证书)原版定制最新版西班牙拉蒙鲁尔大学毕业证(URL毕业证书)原版定制
最新版西班牙拉蒙鲁尔大学毕业证(URL毕业证书)原版定制
Taqyea
 
Empowering voices by Mariam-Sophie Karl: a Service Design project made in Swi...
Empowering voices by Mariam-Sophie	Karl: a Service Design project made in Swi...Empowering voices by Mariam-Sophie	Karl: a Service Design project made in Swi...
Empowering voices by Mariam-Sophie Karl: a Service Design project made in Swi...
sdnswitzerland
 
Computer Aided Design Introduction Lecture
Computer Aided Design Introduction LectureComputer Aided Design Introduction Lecture
Computer Aided Design Introduction Lecture
ShavinGopee2
 
The_Sciencehggshshs_of_Everyday_Luck.pptx
The_Sciencehggshshs_of_Everyday_Luck.pptxThe_Sciencehggshshs_of_Everyday_Luck.pptx
The_Sciencehggshshs_of_Everyday_Luck.pptx
zyx10283746
 
Digital Poster PPT.pptx..............................
Digital Poster PPT.pptx..............................Digital Poster PPT.pptx..............................
Digital Poster PPT.pptx..............................
AhmedAboElSeoud3
 
CapCut Overlay GuideCapCut Overlay GuideCapCut Overlay Guide
CapCut Overlay GuideCapCut Overlay GuideCapCut Overlay GuideCapCut Overlay GuideCapCut Overlay GuideCapCut Overlay Guide
CapCut Overlay GuideCapCut Overlay GuideCapCut Overlay Guide
albertopamatian
 
Narrative research for qualitative research
Narrative research for  qualitative researchNarrative research for  qualitative research
Narrative research for qualitative research
gameghor1591
 
Mountain Lodge Retreat : Reclaimed Vintage Doors | Mogulinterior
Mountain Lodge Retreat : Reclaimed Vintage Doors | MogulinteriorMountain Lodge Retreat : Reclaimed Vintage Doors | Mogulinterior
Mountain Lodge Retreat : Reclaimed Vintage Doors | Mogulinterior
Era Chandok
 
Poster Design Principles lesson for Kids
Poster Design Principles lesson for KidsPoster Design Principles lesson for Kids
Poster Design Principles lesson for Kids
emiliechingwork
 
Chapter 5 - 2,Chapter 5 - 2,Chapter 5 - 2
Chapter 5 - 2,Chapter 5 - 2,Chapter 5 - 2Chapter 5 - 2,Chapter 5 - 2,Chapter 5 - 2
Chapter 5 - 2,Chapter 5 - 2,Chapter 5 - 2
NaveedRehman55
 
Villa de'Urgell X -.pdf A single family two-story residence to be built in tw...
Villa de'Urgell X -.pdf A single family two-story residence to be built in tw...Villa de'Urgell X -.pdf A single family two-story residence to be built in tw...
Villa de'Urgell X -.pdf A single family two-story residence to be built in tw...
Manny Vesa
 
PPT_6.-Digital-Payments-Process-Safeguards.pptx
PPT_6.-Digital-Payments-Process-Safeguards.pptxPPT_6.-Digital-Payments-Process-Safeguards.pptx
PPT_6.-Digital-Payments-Process-Safeguards.pptx
thavvaveerareddy
 
UV_Unwrapping_Game_Dev_Alt.pptx ai presentation of animation
UV_Unwrapping_Game_Dev_Alt.pptx ai presentation of animationUV_Unwrapping_Game_Dev_Alt.pptx ai presentation of animation
UV_Unwrapping_Game_Dev_Alt.pptx ai presentation of animation
17218
 
最新版西班牙比亚努埃瓦国际大学毕业证(UNIR毕业证书)原版定制
最新版西班牙比亚努埃瓦国际大学毕业证(UNIR毕业证书)原版定制最新版西班牙比亚努埃瓦国际大学毕业证(UNIR毕业证书)原版定制
最新版西班牙比亚努埃瓦国际大学毕业证(UNIR毕业证书)原版定制
Taqyea
 
Chromatic house a case study presentation arch.pptx
Chromatic house a case study presentation arch.pptxChromatic house a case study presentation arch.pptx
Chromatic house a case study presentation arch.pptx
maheshwarigarvit2006
 
ARTS IN DAILY LIVING-DRAWING TECHNIQUES_125650.pptx
ARTS IN DAILY LIVING-DRAWING TECHNIQUES_125650.pptxARTS IN DAILY LIVING-DRAWING TECHNIQUES_125650.pptx
ARTS IN DAILY LIVING-DRAWING TECHNIQUES_125650.pptx
christopherdada99
 
Midwifery_Led_Care_Units_Presentation.pptx
Midwifery_Led_Care_Units_Presentation.pptxMidwifery_Led_Care_Units_Presentation.pptx
Midwifery_Led_Care_Units_Presentation.pptx
rajanirprasadkrishna
 
Grade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptx
Grade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptx
Grade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptx
MaKristinaBuenaventu1
 
最新版美国北密歇根大学毕业证(NMU毕业证书)原版定制
最新版美国北密歇根大学毕业证(NMU毕业证书)原版定制最新版美国北密歇根大学毕业证(NMU毕业证书)原版定制
最新版美国北密歇根大学毕业证(NMU毕业证书)原版定制
Taqyea
 
最新版西班牙拉蒙鲁尔大学毕业证(URL毕业证书)原版定制
最新版西班牙拉蒙鲁尔大学毕业证(URL毕业证书)原版定制最新版西班牙拉蒙鲁尔大学毕业证(URL毕业证书)原版定制
最新版西班牙拉蒙鲁尔大学毕业证(URL毕业证书)原版定制
Taqyea
 
Empowering voices by Mariam-Sophie Karl: a Service Design project made in Swi...
Empowering voices by Mariam-Sophie	Karl: a Service Design project made in Swi...Empowering voices by Mariam-Sophie	Karl: a Service Design project made in Swi...
Empowering voices by Mariam-Sophie Karl: a Service Design project made in Swi...
sdnswitzerland
 
Computer Aided Design Introduction Lecture
Computer Aided Design Introduction LectureComputer Aided Design Introduction Lecture
Computer Aided Design Introduction Lecture
ShavinGopee2
 
The_Sciencehggshshs_of_Everyday_Luck.pptx
The_Sciencehggshshs_of_Everyday_Luck.pptxThe_Sciencehggshshs_of_Everyday_Luck.pptx
The_Sciencehggshshs_of_Everyday_Luck.pptx
zyx10283746
 
Digital Poster PPT.pptx..............................
Digital Poster PPT.pptx..............................Digital Poster PPT.pptx..............................
Digital Poster PPT.pptx..............................
AhmedAboElSeoud3
 
CapCut Overlay GuideCapCut Overlay GuideCapCut Overlay Guide
CapCut Overlay GuideCapCut Overlay GuideCapCut Overlay GuideCapCut Overlay GuideCapCut Overlay GuideCapCut Overlay Guide
CapCut Overlay GuideCapCut Overlay GuideCapCut Overlay Guide
albertopamatian
 
Narrative research for qualitative research
Narrative research for  qualitative researchNarrative research for  qualitative research
Narrative research for qualitative research
gameghor1591
 
Mountain Lodge Retreat : Reclaimed Vintage Doors | Mogulinterior
Mountain Lodge Retreat : Reclaimed Vintage Doors | MogulinteriorMountain Lodge Retreat : Reclaimed Vintage Doors | Mogulinterior
Mountain Lodge Retreat : Reclaimed Vintage Doors | Mogulinterior
Era Chandok
 
Poster Design Principles lesson for Kids
Poster Design Principles lesson for KidsPoster Design Principles lesson for Kids
Poster Design Principles lesson for Kids
emiliechingwork
 
Chapter 5 - 2,Chapter 5 - 2,Chapter 5 - 2
Chapter 5 - 2,Chapter 5 - 2,Chapter 5 - 2Chapter 5 - 2,Chapter 5 - 2,Chapter 5 - 2
Chapter 5 - 2,Chapter 5 - 2,Chapter 5 - 2
NaveedRehman55
 
Villa de'Urgell X -.pdf A single family two-story residence to be built in tw...
Villa de'Urgell X -.pdf A single family two-story residence to be built in tw...Villa de'Urgell X -.pdf A single family two-story residence to be built in tw...
Villa de'Urgell X -.pdf A single family two-story residence to be built in tw...
Manny Vesa
 
PPT_6.-Digital-Payments-Process-Safeguards.pptx
PPT_6.-Digital-Payments-Process-Safeguards.pptxPPT_6.-Digital-Payments-Process-Safeguards.pptx
PPT_6.-Digital-Payments-Process-Safeguards.pptx
thavvaveerareddy
 
UV_Unwrapping_Game_Dev_Alt.pptx ai presentation of animation
UV_Unwrapping_Game_Dev_Alt.pptx ai presentation of animationUV_Unwrapping_Game_Dev_Alt.pptx ai presentation of animation
UV_Unwrapping_Game_Dev_Alt.pptx ai presentation of animation
17218
 
最新版西班牙比亚努埃瓦国际大学毕业证(UNIR毕业证书)原版定制
最新版西班牙比亚努埃瓦国际大学毕业证(UNIR毕业证书)原版定制最新版西班牙比亚努埃瓦国际大学毕业证(UNIR毕业证书)原版定制
最新版西班牙比亚努埃瓦国际大学毕业证(UNIR毕业证书)原版定制
Taqyea
 
Chromatic house a case study presentation arch.pptx
Chromatic house a case study presentation arch.pptxChromatic house a case study presentation arch.pptx
Chromatic house a case study presentation arch.pptx
maheshwarigarvit2006
 
ARTS IN DAILY LIVING-DRAWING TECHNIQUES_125650.pptx
ARTS IN DAILY LIVING-DRAWING TECHNIQUES_125650.pptxARTS IN DAILY LIVING-DRAWING TECHNIQUES_125650.pptx
ARTS IN DAILY LIVING-DRAWING TECHNIQUES_125650.pptx
christopherdada99
 
Midwifery_Led_Care_Units_Presentation.pptx
Midwifery_Led_Care_Units_Presentation.pptxMidwifery_Led_Care_Units_Presentation.pptx
Midwifery_Led_Care_Units_Presentation.pptx
rajanirprasadkrishna
 

Modular HTML & CSS Workshop

  • 1. TACTICAL HTML & CSS Shay Howe @shayhowe learn.shayhowe.com MODULAR HTML & CSS WORKSHOP
  • 2. @shayhoweModular HTML & CSS Shay Howe @shayhowe learn.shayhowe.com
  • 3. @shayhoweModular HTML & CSS 1. The Problem 2. Groundwork 3. Assembling Layout 4. Accommodating Content 5. Onward OUR SCHEDULE
  • 4. @shayhoweModular HTML & CSS THE PROBLEM
  • 5. The Gust by Willem van de Velde the Younger
  • 6. @shayhoweModular HTML & CSS COMMON PROBLEMS • Websites have difficulty scaling • Code becomes brittle • Files and code bases begin to swell
  • 7. @shayhoweModular HTML & CSS WHAT’S WRONG • Best practices aren’t exactly best practices • Standards need to evolve
  • 8. @shayhoweModular HTML & CSS BEST BAD PRACTICES • Avoid extra elements • Avoid classes • Leverage type selectors • Leverage descendent selectors
  • 9. @shayhoweModular HTML & CSS BEST BAD PRACTICES Avoiding classes section  ul#nav  li  {...} section:nth-­‐child(2)  div:nth-­‐child(7)  >  a  {...} Leveraging selectors a.btn  {...} #main  a.btn  {...} #main  div.feature  a.btn  {...}
  • 10. @shayhoweModular HTML & CSS BEST BAD PRACTICES Bad #contact  li:nth-­‐child(1)  input, #contact  li:nth-­‐child(2)  input  {    width:  160px; } #contact  li:nth-­‐child(3)  textarea  {    width:  280px; }
  • 11. @shayhoweModular HTML & CSS BEST BAD PRACTICES Good .col-­‐1  {    width:  160px; } .col-­‐2  {    width:  280px; }
  • 12. @shayhoweModular HTML & CSS SPECIFICITY? • Specificity determines which styles are applied • Each selector has a specificity weight • High specificity beats low specificity • Low specificity is key
  • 13. @shayhoweModular HTML & CSS MEASURING SPECIFICITY Formula • IDs, Classes/Pseudo-classes/Attributes, Elements High Specificity (Bad) #primary  #main  div.gallery  figure.media IDs: 2, Classes: 2, Elements: 2 — Compiled: 2–2–2 Low Specificity (Good) .gallery-­‐media IDs: 0, Classes: 1, Elements: 0 — Compiled: 0–1–0
  • 15. @shayhoweModular HTML & CSS WATCH SPECIFICITY • Be explicit • Keep specificity low • Never use IDs or !important • Avoid nested selectors (#main  .spotlight  strong  span)
  • 16. @shayhoweModular HTML & CSS WATCH SPECIFICITY Bad #primary  #main  div.gallery  {    text-­‐transform:  uppercase; } #primary  #main  div.gallery  figure.media  {    background:  #ccc; }
  • 17. @shayhoweModular HTML & CSS WATCH SPECIFICITY Good .gallery  {    text-­‐transform:  uppercase; } .gallery-­‐media  {    background:  #ccc; }
  • 18. Parade of the Black Sea Fleet by Ivan Aivazovsky
  • 19. @shayhoweModular HTML & CSS MAINTAINABILITY Code must be... • Organized • Modular • Performant
  • 20. @shayhoweModular HTML & CSS METHODOLOGIES OOCSS • Object-Oriented CSS From Nicole Sullivan – oocss.org SMACSS • Scalable and Modular Architecture for CSS From Jonathan Snook – smacss.com
  • 21. @shayhoweModular HTML & CSS GROUNDWORK
  • 22. @shayhoweModular HTML & CSS REUSE CODE • Do not duplicate code • Remove old code • Defer loading subsequent styles
  • 23. @shayhoweModular HTML & CSS REUSE CODE Bad .news  {    background:  #eee;    color:  #666; } .social  {    background:  #eee;    color:  #666; }
  • 24. @shayhoweModular HTML & CSS REUSE CODE Good .news, .social  {    background:  #eee;    color:  #666; } Better .feat-­‐box  {    background:  #eee;    color:  #666; }
  • 25. @shayhoweModular HTML & CSS USE CLASSES • Write understandable class names • Avoid unnecessary nesting • Use same strength specificity
  • 26. @shayhoweModular HTML & CSS USE CLASSES Bad .feat-­‐box  .callout  .pr  {    font-­‐size:  12px; } .feat-­‐box  .callout  .pr  .un  {    color:  #39f; }
  • 27. @shayhoweModular HTML & CSS USE CLASSES Good .feat-­‐box  .price  {    font-­‐size:  12px; } .feat-­‐box  .unit  {    color:  #39f; }
  • 28. @shayhoweModular HTML & CSS USE CLASSES Bad .btn.large  {    font-­‐size:  24px;        padding:  15px  30px; } <div  class="btn  large">...</div>
  • 29. @shayhoweModular HTML & CSS USE CLASSES Good .btn-­‐large  {    font-­‐size:  24px;    padding:  15px  30px; } <div  class="btn-­‐large">...</div>
  • 30. @shayhoweModular HTML & CSS ASSEMBLING LAYOUT
  • 31. @shayhoweModular HTML & CSS ABSTRACT STRUCTURE • Separate presentation (or theme) from layout • Create an object layer for layout • Create a skin layer for theme • Use a grid
  • 32. @shayhoweModular HTML & CSS ABSTRACT STRUCTURE Bad .news  {    background:  #eee;    color:  #666;    margin:  0  10px;    width:  400px; } <div  class="news">...</div>
  • 33. @shayhoweModular HTML & CSS ABSTRACT STRUCTURE Good .grid-­‐4  {    margin:  0  10px;    width:  400px; } .feat-­‐box  {    background:  #eee;    color:  #666; } <div  class="grid-­‐4  feat-­‐box">...</div>
  • 34. @shayhoweModular HTML & CSS TRANSPARENTIZE ELEMENTS • Stylize elements to be transparent • Keep visual properties apart from layout properties
  • 35. @shayhoweModular HTML & CSS TRANSPARENTIZE ELEMENTS Bad .pagination  {    border-­‐radius:  5px;    border:  1px  solid  #eee;    margin:  0  10px;    width:  620px; } <ul  class="pagination">...</ul>
  • 36. @shayhoweModular HTML & CSS TRANSPARENTIZE ELEMENTS Good .grid-­‐8  {    margin:  0  10px;    width:  620px; } .offset-­‐box  {    border-­‐radius:  5px;    border:  1px  solid  #eee; } <ul  class="grid-­‐8  offset-­‐box">...</ul>
  • 37. @shayhoweModular HTML & CSS CREATE ADAPTABLE LAYOUTS • Height and width should be flexible • Height should extend with content • Width should extend with a grid
  • 38. @shayhoweModular HTML & CSS CREATE ADAPTABLE LAYOUTS Bad #main  {    float:  left;    margin:  0  10px;    width:  620px; } #aside  {    float:  left;    margin:  0  10px;    width:  300px; }
  • 39. @shayhoweModular HTML & CSS CREATE ADAPTABLE LAYOUTS Good .grid-­‐4, .grid-­‐8  {    float:  left;    margin:  0  10px; } .grid-­‐4  {    width:  300px; } .grid-­‐8  {    width:  620px; }
  • 40. @shayhoweModular HTML & CSS ASSEMBLING LAYOUT IN PRACTICE http://bit.ly/modular-html-css
  • 41. @shayhoweModular HTML & CSS ACCOMMODATING CONTENT
  • 42. @shayhoweModular HTML & CSS SEPARATE CONTENT • Separate content from container • Stylize content regardless of container
  • 43. @shayhoweModular HTML & CSS SEPARATE CONTENT Bad .alert  {    background:  #f2dede;    border-­‐radius:  10px;    color:  #b94a48;    padding:  10px  20px; } <div  class="alert">...</div>
  • 44. @shayhoweModular HTML & CSS SEPARATE CONTENT Good .alert  {    border-­‐radius:  10px;    padding:  10px  20px; } .alert-­‐error  {    background:  #f2dede;    color:  #b94a48; } <div  class="alert  alert-­‐error">...</div>
  • 45. @shayhoweModular HTML & CSS AVOID PARENT DEPENDENCY • Remove parent container dependency • Decouple CSS from HTML • Create components to be used anywhere
  • 46. @shayhoweModular HTML & CSS AVOID PARENT DEPENDENCY Bad .feat-­‐box  {    background:  #eee; } article  .feat-­‐box  {    background:  #fff; } <article>    <div  class="feat-­‐box">...</div> </article>
  • 47. @shayhoweModular HTML & CSS AVOID PARENT DEPENDENCY Good .feat-­‐box  {    background:  #eee; } .feat-­‐box-­‐alt  {    background:  #fff; } <article>    <div  class="feat-­‐box-­‐alt">...</div> </article>
  • 48. @shayhoweModular HTML & CSS FAVOR SEMANTICS • Allow elements to adapt • Uses individual classes to extend modules
  • 49. @shayhoweModular HTML & CSS FAVOR SEMANTICS Bad .feat-­‐box  h2  {    color:  #f60;    font:  18px  Helvetica,  sans-­‐serif; } <div  class="feat-­‐box">    <h2>...</h2> </div>
  • 50. @shayhoweModular HTML & CSS FAVOR SEMANTICS Good .feat-­‐subhead  {    color:  #f60;    font:  18px  Helvetica,  sans-­‐serif; } <div  class="feat-­‐box">    <h2  class="feat-­‐subhead">...</h2> </div>
  • 51. @shayhoweModular HTML & CSS ACCOMMODATING CONTENT IN PRACTICE http://bit.ly/modular-html-css
  • 53. Ships on the Roadstead by Willem van de Velde the Younger
  • 54. @shayhoweModular HTML & CSS APPROACH • Stop thinking about pages • Start thinking about components • Take visual inventory
  • 55. @shayhoweModular HTML & CSS THEMES • Decouple HTML and CSS • Separate presentation from layout • Separate content from container • Extend elements with classes
  • 56. @shayhoweModular HTML & CSS OUTCOMES • Maintainability! • Reusable code, less duplication • Flexibility and extensibility • Improved standards
  • 57. @shayhoweModular HTML & CSS WHAT’S NEXT Build a styleguide • Twitter Bootstrap, Zurb Foundation Review methodologies • OOCSS, SMACSS Test your code • CSS Lint, Inspector, PageSpeed
  • 58. @shayhoweModular HTML & CSS THANK YOU! Questions? @shayhowe http://learn.shayhowe.com