SlideShare ist ein Scribd-Unternehmen logo
1 von 55
Downloaden Sie, um offline zu lesen
TACTICAL
HTML & CSS
Shay Howe
@shayhowe
shayhowe.com
MODULAR
HTML & CSS
@shayhoweModular HTML & CSS
SHAY HOWE
shayhowe.com – @shayhowe
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
Parade of the Black Sea Fleet by Ivan Aivazovsky
@shayhoweModular HTML & CSS
MAINTAINABILITY
Code must be...
• Organized
• Modular
• Performant
@shayhoweModular HTML & CSS
ORGANIZATION
@shayhoweModular HTML & CSS
APPROACH
• Stop thinking about pages
• Start thinking about components
• Take visual inventory
@shayhoweModular HTML & CSS
TECHNIQUE
Base
• Core styles for entire site
Normalize (Reset), Default Elements, Grid, Variables
Components
• User interface concepts & design patterns
Alerts, Buttons, Forms, List, Pagination, Tooltips
Modules
• Business logic
Aside, Header, Footer
@shayhoweModular HTML & CSS
TECHNIQUE
@shayhoweModular HTML & CSS
MODULARITY
@shayhoweModular HTML & CSS
ASSEMBLE LAYOUT
• Separate presentation (or theme) from layout
• Create an object layer for layout
• Create a skin layer for theme
• Use a grid
@shayhoweModular HTML & CSS
ASSEMBLE LAYOUT
Bad
.news	
  {
	
  	
  background:	
  #eee;
	
  	
  color:	
  #666;
	
  	
  margin:	
  0	
  10px;
	
  	
  width:	
  400px;
}
<div	
  class="news">...</div>
@shayhoweModular HTML & CSS
ASSEMBLE LAYOUT
Good
.grid-­‐4	
  {
	
  	
  margin:	
  0	
  10px;
	
  	
  width:	
  400px;
}
.feat-­‐box	
  {
	
  	
  background:	
  #eee;
	
  	
  color:	
  #666;
}
<div	
  class="grid-­‐4	
  feat-­‐box">...</div>
@shayhoweModular HTML & CSS
ACCOMMODATE CONTENT
• Separate content from container
• Stylize content regardless of container
@shayhoweModular HTML & CSS
ACCOMMODATE CONTENT
Bad
.alert	
  {
	
  	
  background:	
  #f2dede;
	
  	
  border-­‐radius:	
  10px;
	
  	
  color:	
  #b94a48;
	
  	
  padding:	
  10px	
  20px;
}
<div	
  class="alert">...</div>
@shayhoweModular HTML & CSS
ACCOMMODATE 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
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;
}
@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
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
PERFORMANCE
@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
MINIMIZE REQUEST
• Combine like files (CSS & JS)
• Use image sprites
• Leverage data URIs
• Icon fonts
@shayhoweModular HTML & CSS
IMAGE SPRITES
<span	
  class="icon	
  i-­‐twitter">...</span>
<span	
  class="icon	
  i-­‐facebook">...</span>
.icon	
  {
	
  	
  background:	
  url("icons.png")	
  0	
  0	
  no-­‐repeat;
}
.i-­‐twitter	
  {
	
  	
  background-­‐position:	
  0	
  -­‐16px;
}
.i-­‐facebook	
  {
	
  	
  background-­‐position:	
  0	
  -­‐32px;
}
@shayhoweModular HTML & CSS
DATA URIS
HTML
<img	
  height="100"	
  width="660"	
  alt="Pattern"	
  
src="data:imagepng;base64,...">
CSS
.pattern	
  {
	
  	
  background:	
  url("data:imagepng;base64,...")	
  
	
  	
  	
  	
  repeat;
}
@shayhoweModular HTML & CSS
COMPRESS & CACHE FILES
• Utilize Gzip compression
• Losslessly compress images
• Cache common files
COMPRESS & CACHE FILES
@shayhoweModular HTML & CSS
COMPRESS & CACHE FILES
@shayhoweModular HTML & CSS
COMPRESS & CACHE FILES
Original 455kb Optimized 401kb
Ships on the Roadstead by Willem van de Velde the Younger
@shayhoweModular HTML & CSS
GETTING STARTED
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
http://bit.ly/mod-html-css

Weitere ähnliche Inhalte

Was ist angesagt?

Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucksTim Wright
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreRuss Weakley
 
Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)Hajas Tamás
 
TOSSUG HTML5 讀書會 新標籤與表單
TOSSUG HTML5 讀書會 新標籤與表單TOSSUG HTML5 讀書會 新標籤與表單
TOSSUG HTML5 讀書會 新標籤與表單偉格 高
 
Advanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & EfficiencyAdvanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & EfficiencyDenise Jacobs
 
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Deepak Sharma
 
Advanced CSS Troubleshooting
Advanced CSS TroubleshootingAdvanced CSS Troubleshooting
Advanced CSS TroubleshootingDenise Jacobs
 
Basics of Front End Web Dev PowerPoint
Basics of Front End Web Dev PowerPointBasics of Front End Web Dev PowerPoint
Basics of Front End Web Dev PowerPointSahil Gandhi
 
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
 
Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3Todd Zaki Warfel
 
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 BootstrapJosh Jeffryes
 
CSS Frameworks
CSS FrameworksCSS Frameworks
CSS FrameworksMike Crabb
 
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
 
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 jQueryTodd Zaki Warfel
 

Was ist angesagt? (20)

Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucks
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
 
HTML News Packages Lesson
HTML News Packages LessonHTML News Packages Lesson
HTML News Packages Lesson
 
Joomla Technical SEO
Joomla Technical SEOJoomla Technical SEO
Joomla Technical SEO
 
Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)
 
TOSSUG HTML5 讀書會 新標籤與表單
TOSSUG HTML5 讀書會 新標籤與表單TOSSUG HTML5 讀書會 新標籤與表單
TOSSUG HTML5 讀書會 新標籤與表單
 
Advanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & EfficiencyAdvanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & Efficiency
 
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
 
Advanced CSS Troubleshooting
Advanced CSS TroubleshootingAdvanced CSS Troubleshooting
Advanced CSS Troubleshooting
 
Basics of Front End Web Dev PowerPoint
Basics of Front End Web Dev PowerPointBasics of Front End Web Dev PowerPoint
Basics of Front End Web Dev PowerPoint
 
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
 
Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3
 
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
 
CSS Frameworks
CSS FrameworksCSS Frameworks
CSS Frameworks
 
Html5 public
Html5 publicHtml5 public
Html5 public
 
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)
 
Demystifying WordPress Conditional Tags
Demystifying WordPress Conditional TagsDemystifying WordPress Conditional Tags
Demystifying WordPress Conditional Tags
 
Intro to CSS Presentation
Intro to CSS PresentationIntro to CSS Presentation
Intro to CSS Presentation
 
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
 
Html5 ux london
Html5 ux londonHtml5 ux london
Html5 ux london
 

Andere mochten auch

Lightning Components and App Builder for admins
Lightning Components and App Builder for adminsLightning Components and App Builder for admins
Lightning Components and App Builder for adminsAlba Azcona Rivas
 
Elearning how tostart-eng
Elearning how tostart-engElearning how tostart-eng
Elearning how tostart-engVu Duong
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsTessa Mero
 
que es Rss, funcionamiento y tipos
que es Rss, funcionamiento y tipos que es Rss, funcionamiento y tipos
que es Rss, funcionamiento y tipos Edwin Rodriguez
 
4 b power point
4 b power point4 b power point
4 b power pointenecorcu
 
Digital transformation vkw (1)
Digital transformation vkw (1)Digital transformation vkw (1)
Digital transformation vkw (1)ETION
 
Excel 2007. Nivel avanzado
Excel 2007. Nivel avanzado Excel 2007. Nivel avanzado
Excel 2007. Nivel avanzado Congente
 
709 cepeda diseño de metodologia de enseñanza
709 cepeda diseño de metodologia de enseñanza709 cepeda diseño de metodologia de enseñanza
709 cepeda diseño de metodologia de enseñanzasocorro Juarez
 
Modern UI development with Lightning Components - Spanish!
Modern UI development with Lightning Components - Spanish!Modern UI development with Lightning Components - Spanish!
Modern UI development with Lightning Components - Spanish!Alba Azcona Rivas
 
Technology and the concepts of technology
Technology and the concepts of technologyTechnology and the concepts of technology
Technology and the concepts of technologyi4VC
 
Strategic Communications Planning for NPOs
Strategic Communications Planning for NPOsStrategic Communications Planning for NPOs
Strategic Communications Planning for NPOsArts4good
 
Product Development Principles
Product Development PrinciplesProduct Development Principles
Product Development Principlesi4VC
 
America's Divided Recovery: College Haves and Have-Nots
America's Divided Recovery: College Haves and Have-NotsAmerica's Divided Recovery: College Haves and Have-Nots
America's Divided Recovery: College Haves and Have-NotsCEW Georgetown
 
Changellenge | Cup Kazakhstan 2016 | Leroy Merlin case | 1st place
Changellenge | Cup Kazakhstan 2016 | Leroy Merlin case | 1st placeChangellenge | Cup Kazakhstan 2016 | Leroy Merlin case | 1st place
Changellenge | Cup Kazakhstan 2016 | Leroy Merlin case | 1st placeCrystal Spring
 

Andere mochten auch (20)

Lightning Components and App Builder for admins
Lightning Components and App Builder for adminsLightning Components and App Builder for admins
Lightning Components and App Builder for admins
 
Auguste marie louis nicolas lumière
Auguste marie louis nicolas lumièreAuguste marie louis nicolas lumière
Auguste marie louis nicolas lumière
 
La revolución mexicana 1
La revolución mexicana 1La revolución mexicana 1
La revolución mexicana 1
 
Docker Workbench
Docker WorkbenchDocker Workbench
Docker Workbench
 
Elearning how tostart-eng
Elearning how tostart-engElearning how tostart-eng
Elearning how tostart-eng
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple Steps
 
Rosandry
RosandryRosandry
Rosandry
 
que es Rss, funcionamiento y tipos
que es Rss, funcionamiento y tipos que es Rss, funcionamiento y tipos
que es Rss, funcionamiento y tipos
 
4 b power point
4 b power point4 b power point
4 b power point
 
Digital transformation vkw (1)
Digital transformation vkw (1)Digital transformation vkw (1)
Digital transformation vkw (1)
 
Erge
ErgeErge
Erge
 
Excel 2007. Nivel avanzado
Excel 2007. Nivel avanzado Excel 2007. Nivel avanzado
Excel 2007. Nivel avanzado
 
709 cepeda diseño de metodologia de enseñanza
709 cepeda diseño de metodologia de enseñanza709 cepeda diseño de metodologia de enseñanza
709 cepeda diseño de metodologia de enseñanza
 
Modern UI development with Lightning Components - Spanish!
Modern UI development with Lightning Components - Spanish!Modern UI development with Lightning Components - Spanish!
Modern UI development with Lightning Components - Spanish!
 
Technology and the concepts of technology
Technology and the concepts of technologyTechnology and the concepts of technology
Technology and the concepts of technology
 
Examen historia
Examen historia Examen historia
Examen historia
 
Strategic Communications Planning for NPOs
Strategic Communications Planning for NPOsStrategic Communications Planning for NPOs
Strategic Communications Planning for NPOs
 
Product Development Principles
Product Development PrinciplesProduct Development Principles
Product Development Principles
 
America's Divided Recovery: College Haves and Have-Nots
America's Divided Recovery: College Haves and Have-NotsAmerica's Divided Recovery: College Haves and Have-Nots
America's Divided Recovery: College Haves and Have-Nots
 
Changellenge | Cup Kazakhstan 2016 | Leroy Merlin case | 1st place
Changellenge | Cup Kazakhstan 2016 | Leroy Merlin case | 1st placeChangellenge | Cup Kazakhstan 2016 | Leroy Merlin case | 1st place
Changellenge | Cup Kazakhstan 2016 | Leroy Merlin case | 1st place
 

Ähnlich wie Modular HTML & CSS

Be nice to your designers
Be nice to your designersBe nice to your designers
Be nice to your designersPai-Cheng Tao
 
CSS workshop @ OutSystems
CSS workshop @ OutSystemsCSS workshop @ OutSystems
CSS workshop @ OutSystemsRuben Goncalves
 
Highly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSHighly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSZoe Gillenwater
 
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nlSource Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nlJoomla!Days Netherlands
 
Css for Development
Css for DevelopmentCss for Development
Css for Developmenttsengsite
 
Thinkful - Frontend Crash Course - Intro to HTML/CSS
Thinkful - Frontend Crash Course - Intro to HTML/CSSThinkful - Frontend Crash Course - Intro to HTML/CSS
Thinkful - Frontend Crash Course - Intro to HTML/CSSTJ Stalcup
 
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSSObject-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSSLi-Wei Lu
 
Implementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 WorkshopImplementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 WorkshopShoshi Roberts
 
An Intro to HTML & CSS
An Intro to HTML & CSSAn Intro to HTML & CSS
An Intro to HTML & CSSShay Howe
 
Css week10 2019 2020 for g10 by eng.osama ghandour
Css week10 2019 2020 for g10 by eng.osama ghandourCss week10 2019 2020 for g10 by eng.osama ghandour
Css week10 2019 2020 for g10 by eng.osama ghandourOsama Ghandour Geris
 
Joomla! Day Chicago 2011 - Templating the right way - Jonathan Shroyer
Joomla! Day Chicago 2011 - Templating the right way - Jonathan ShroyerJoomla! Day Chicago 2011 - Templating the right way - Jonathan Shroyer
Joomla! Day Chicago 2011 - Templating the right way - Jonathan ShroyerSteven Pignataro
 
The Future is Modular, Jonathan Snook
The Future is Modular, Jonathan SnookThe Future is Modular, Jonathan Snook
The Future is Modular, Jonathan SnookFuture Insights
 
Html:css crash course (4:5)
Html:css crash course (4:5)Html:css crash course (4:5)
Html:css crash course (4:5)Thinkful
 

Ähnlich wie Modular HTML & CSS (20)

Web
WebWeb
Web
 
Be nice to your designers
Be nice to your designersBe nice to your designers
Be nice to your designers
 
CSS workshop @ OutSystems
CSS workshop @ OutSystemsCSS workshop @ OutSystems
CSS workshop @ OutSystems
 
Highly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSHighly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSS
 
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nlSource Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
 
Css intro
Css introCss intro
Css intro
 
Css for Development
Css for DevelopmentCss for Development
Css for Development
 
Pertemuan 7
Pertemuan 7Pertemuan 7
Pertemuan 7
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
Thinkful - Frontend Crash Course - Intro to HTML/CSS
Thinkful - Frontend Crash Course - Intro to HTML/CSSThinkful - Frontend Crash Course - Intro to HTML/CSS
Thinkful - Frontend Crash Course - Intro to HTML/CSS
 
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSSObject-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
 
Implementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 WorkshopImplementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 Workshop
 
An Intro to HTML & CSS
An Intro to HTML & CSSAn Intro to HTML & CSS
An Intro to HTML & CSS
 
Css week10 2019 2020 for g10 by eng.osama ghandour
Css week10 2019 2020 for g10 by eng.osama ghandourCss week10 2019 2020 for g10 by eng.osama ghandour
Css week10 2019 2020 for g10 by eng.osama ghandour
 
Joomla! Day Chicago 2011 - Templating the right way - Jonathan Shroyer
Joomla! Day Chicago 2011 - Templating the right way - Jonathan ShroyerJoomla! Day Chicago 2011 - Templating the right way - Jonathan Shroyer
Joomla! Day Chicago 2011 - Templating the right way - Jonathan Shroyer
 
Css
CssCss
Css
 
The Future is Modular, Jonathan Snook
The Future is Modular, Jonathan SnookThe Future is Modular, Jonathan Snook
The Future is Modular, Jonathan Snook
 
Html:css crash course (4:5)
Html:css crash course (4:5)Html:css crash course (4:5)
Html:css crash course (4:5)
 
Class15
Class15Class15
Class15
 
Efficient theming in Drupal
Efficient theming in DrupalEfficient theming in Drupal
Efficient theming in Drupal
 

Mehr von 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 LeaderShay Howe
 
Collaboration Practices
Collaboration PracticesCollaboration Practices
Collaboration PracticesShay Howe
 
How Constraints Cultivate Growth
How Constraints Cultivate GrowthHow Constraints Cultivate Growth
How Constraints Cultivate GrowthShay Howe
 
UI Design with HTML5 & CSS3
UI Design with HTML5 & CSS3UI Design with HTML5 & CSS3
UI Design with HTML5 & CSS3Shay Howe
 
HTML5 Semantics
HTML5 SemanticsHTML5 Semantics
HTML5 SemanticsShay Howe
 
Quality Development with HTML5
Quality Development with HTML5Quality Development with HTML5
Quality Development with HTML5Shay Howe
 
Quality Development with CSS3
Quality Development with CSS3Quality Development with CSS3
Quality Development with CSS3Shay 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 SuccessShay 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 StrategyShay Howe
 

Mehr von 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
 
Collaboration Practices
Collaboration PracticesCollaboration Practices
Collaboration Practices
 
How Constraints Cultivate Growth
How Constraints Cultivate GrowthHow Constraints Cultivate Growth
How Constraints Cultivate Growth
 
UI Design with HTML5 & CSS3
UI Design with HTML5 & CSS3UI Design with HTML5 & CSS3
UI Design with HTML5 & CSS3
 
HTML5 Semantics
HTML5 SemanticsHTML5 Semantics
HTML5 Semantics
 
Quality Development with HTML5
Quality Development with HTML5Quality Development with HTML5
Quality Development with HTML5
 
Quality Development with CSS3
Quality Development with CSS3Quality Development with CSS3
Quality Development with CSS3
 
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
 
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
 

Kürzlich hochgeladen

➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men 🔝dehradun🔝 Escor...
➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men  🔝dehradun🔝   Escor...➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men  🔝dehradun🔝   Escor...
➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men 🔝dehradun🔝 Escor...amitlee9823
 
➥🔝 7737669865 🔝▻ Kolkata Call-girls in Women Seeking Men 🔝Kolkata🔝 Escorts...
➥🔝 7737669865 🔝▻ Kolkata Call-girls in Women Seeking Men  🔝Kolkata🔝   Escorts...➥🔝 7737669865 🔝▻ Kolkata Call-girls in Women Seeking Men  🔝Kolkata🔝   Escorts...
➥🔝 7737669865 🔝▻ Kolkata Call-girls in Women Seeking Men 🔝Kolkata🔝 Escorts...amitlee9823
 
➥🔝 7737669865 🔝▻ dharamshala Call-girls in Women Seeking Men 🔝dharamshala🔝 ...
➥🔝 7737669865 🔝▻ dharamshala Call-girls in Women Seeking Men  🔝dharamshala🔝  ...➥🔝 7737669865 🔝▻ dharamshala Call-girls in Women Seeking Men  🔝dharamshala🔝  ...
➥🔝 7737669865 🔝▻ dharamshala Call-girls in Women Seeking Men 🔝dharamshala🔝 ...amitlee9823
 
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
Sector 105, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 105, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 105, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 105, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
WhatsApp Chat: 📞 8617697112 Call Girl Baran is experienced
WhatsApp Chat: 📞 8617697112 Call Girl Baran is experiencedWhatsApp Chat: 📞 8617697112 Call Girl Baran is experienced
WhatsApp Chat: 📞 8617697112 Call Girl Baran is experiencedNitya salvi
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)amitlee9823
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...Pooja Nehwal
 
High Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
High Profile Escorts Nerul WhatsApp +91-9930687706, Best ServiceHigh Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
High Profile Escorts Nerul WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...nirzagarg
 
Call Girls Jalgaon Just Call 8617370543Top Class Call Girl Service Available
Call Girls Jalgaon Just Call 8617370543Top Class Call Girl Service AvailableCall Girls Jalgaon Just Call 8617370543Top Class Call Girl Service Available
Call Girls Jalgaon Just Call 8617370543Top Class Call Girl Service AvailableNitya salvi
 
Hingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRL
Hingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRLHingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRL
Hingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRLNitya salvi
 
Gamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad IbrahimGamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad Ibrahimamgadibrahim92
 
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...Delhi Call girls
 
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...instagramfab782445
 
Lecture 01 Introduction To Multimedia.pptx
Lecture 01 Introduction To Multimedia.pptxLecture 01 Introduction To Multimedia.pptx
Lecture 01 Introduction To Multimedia.pptxShoaibRajper1
 
Jordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdfJordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdfamanda2495
 
How to Build a Simple Shopify Website
How to Build a Simple Shopify WebsiteHow to Build a Simple Shopify Website
How to Build a Simple Shopify Websitemark11275
 
8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Available
8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Available8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Available
8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Availabledollysharma2066
 

Kürzlich hochgeladen (20)

➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men 🔝dehradun🔝 Escor...
➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men  🔝dehradun🔝   Escor...➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men  🔝dehradun🔝   Escor...
➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men 🔝dehradun🔝 Escor...
 
➥🔝 7737669865 🔝▻ Kolkata Call-girls in Women Seeking Men 🔝Kolkata🔝 Escorts...
➥🔝 7737669865 🔝▻ Kolkata Call-girls in Women Seeking Men  🔝Kolkata🔝   Escorts...➥🔝 7737669865 🔝▻ Kolkata Call-girls in Women Seeking Men  🔝Kolkata🔝   Escorts...
➥🔝 7737669865 🔝▻ Kolkata Call-girls in Women Seeking Men 🔝Kolkata🔝 Escorts...
 
➥🔝 7737669865 🔝▻ dharamshala Call-girls in Women Seeking Men 🔝dharamshala🔝 ...
➥🔝 7737669865 🔝▻ dharamshala Call-girls in Women Seeking Men  🔝dharamshala🔝  ...➥🔝 7737669865 🔝▻ dharamshala Call-girls in Women Seeking Men  🔝dharamshala🔝  ...
➥🔝 7737669865 🔝▻ dharamshala Call-girls in Women Seeking Men 🔝dharamshala🔝 ...
 
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Sector 105, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 105, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 105, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 105, Noida Call girls :8448380779 Model Escorts | 100% verified
 
WhatsApp Chat: 📞 8617697112 Call Girl Baran is experienced
WhatsApp Chat: 📞 8617697112 Call Girl Baran is experiencedWhatsApp Chat: 📞 8617697112 Call Girl Baran is experienced
WhatsApp Chat: 📞 8617697112 Call Girl Baran is experienced
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
 
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman MuscatAbortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
 
High Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
High Profile Escorts Nerul WhatsApp +91-9930687706, Best ServiceHigh Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
High Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
 
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
 
Call Girls Jalgaon Just Call 8617370543Top Class Call Girl Service Available
Call Girls Jalgaon Just Call 8617370543Top Class Call Girl Service AvailableCall Girls Jalgaon Just Call 8617370543Top Class Call Girl Service Available
Call Girls Jalgaon Just Call 8617370543Top Class Call Girl Service Available
 
Hingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRL
Hingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRLHingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRL
Hingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRL
 
Gamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad IbrahimGamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad Ibrahim
 
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
 
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
 
Lecture 01 Introduction To Multimedia.pptx
Lecture 01 Introduction To Multimedia.pptxLecture 01 Introduction To Multimedia.pptx
Lecture 01 Introduction To Multimedia.pptx
 
Jordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdfJordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdf
 
How to Build a Simple Shopify Website
How to Build a Simple Shopify WebsiteHow to Build a Simple Shopify Website
How to Build a Simple Shopify Website
 
8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Available
8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Available8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Available
8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Available
 

Modular HTML & CSS

  • 1. TACTICAL HTML & CSS Shay Howe @shayhowe shayhowe.com MODULAR HTML & CSS
  • 2. @shayhoweModular HTML & CSS SHAY HOWE shayhowe.com – @shayhowe
  • 3. The Gust by Willem van de Velde the Younger
  • 4. @shayhoweModular HTML & CSS COMMON PROBLEMS • Websites have difficulty scaling • Code becomes brittle • Files and code bases begin to swell
  • 5. @shayhoweModular HTML & CSS WHAT’S WRONG • Best practices aren’t exactly best practices • Standards need to evolve
  • 6. @shayhoweModular HTML & CSS BEST BAD PRACTICES • Avoid extra elements • Avoid classes • Leverage type selectors • Leverage descendent selectors
  • 7. @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  {...}
  • 8. @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; }
  • 9. @shayhoweModular HTML & CSS BEST BAD PRACTICES Good .col-­‐1  {    width:  160px; } .col-­‐2  {    width:  280px; }
  • 10. @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
  • 11. Parade of the Black Sea Fleet by Ivan Aivazovsky
  • 12. @shayhoweModular HTML & CSS MAINTAINABILITY Code must be... • Organized • Modular • Performant
  • 13. @shayhoweModular HTML & CSS ORGANIZATION
  • 14. @shayhoweModular HTML & CSS APPROACH • Stop thinking about pages • Start thinking about components • Take visual inventory
  • 15. @shayhoweModular HTML & CSS TECHNIQUE Base • Core styles for entire site Normalize (Reset), Default Elements, Grid, Variables Components • User interface concepts & design patterns Alerts, Buttons, Forms, List, Pagination, Tooltips Modules • Business logic Aside, Header, Footer
  • 16. @shayhoweModular HTML & CSS TECHNIQUE
  • 17. @shayhoweModular HTML & CSS MODULARITY
  • 18. @shayhoweModular HTML & CSS ASSEMBLE LAYOUT • Separate presentation (or theme) from layout • Create an object layer for layout • Create a skin layer for theme • Use a grid
  • 19. @shayhoweModular HTML & CSS ASSEMBLE LAYOUT Bad .news  {    background:  #eee;    color:  #666;    margin:  0  10px;    width:  400px; } <div  class="news">...</div>
  • 20. @shayhoweModular HTML & CSS ASSEMBLE LAYOUT Good .grid-­‐4  {    margin:  0  10px;    width:  400px; } .feat-­‐box  {    background:  #eee;    color:  #666; } <div  class="grid-­‐4  feat-­‐box">...</div>
  • 21. @shayhoweModular HTML & CSS ACCOMMODATE CONTENT • Separate content from container • Stylize content regardless of container
  • 22. @shayhoweModular HTML & CSS ACCOMMODATE CONTENT Bad .alert  {    background:  #f2dede;    border-­‐radius:  10px;    color:  #b94a48;    padding:  10px  20px; } <div  class="alert">...</div>
  • 23. @shayhoweModular HTML & CSS ACCOMMODATE CONTENT Good .alert  {    border-­‐radius:  10px;    padding:  10px  20px; } .alert-­‐error  {    background:  #f2dede;    color:  #b94a48; } <div  class="alert  alert-­‐error">...</div>
  • 24. @shayhoweModular HTML & CSS AVOID PARENT DEPENDENCY • Remove parent container dependency • Decouple CSS from HTML • Create components to be used anywhere
  • 25. @shayhoweModular HTML & CSS AVOID PARENT DEPENDENCY Bad .feat-­‐box  {    background:  #eee; } article  .feat-­‐box  {    background:  #fff; } <article>    <div  class="feat-­‐box">...</div> </article>
  • 26. @shayhoweModular HTML & CSS AVOID PARENT DEPENDENCY Good .feat-­‐box  {    background:  #eee; } .feat-­‐box-­‐alt  {    background:  #fff; } <article>    <div  class="feat-­‐box-­‐alt">...</div> </article>
  • 27. @shayhoweModular HTML & CSS FAVOR SEMANTICS • Allow elements to adapt • Uses individual classes to extend modules
  • 28. @shayhoweModular HTML & CSS FAVOR SEMANTICS Bad .feat-­‐box  h2  {    color:  #f60;    font:  18px  Helvetica,  sans-­‐serif; } <div  class="feat-­‐box">    <h2>...</h2> </div>
  • 29. @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>
  • 30. @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
  • 32. @shayhoweModular HTML & CSS WATCH SPECIFICITY • Be explicit • Keep specificity low • Never use IDs or !important • Avoid nested selectors (#main  .spotlight  strong  span)
  • 33. @shayhoweModular HTML & CSS WATCH SPECIFICITY Bad #primary  #main  div.gallery  {    text-­‐transform:  uppercase; } #primary  #main  div.gallery  figure.media  {    background:  #ccc; }
  • 34. @shayhoweModular HTML & CSS WATCH SPECIFICITY Good .gallery  {    text-­‐transform:  uppercase; } .gallery-­‐media  {    background:  #ccc; }
  • 35. @shayhoweModular HTML & CSS USE CLASSES • Write understandable class names • Avoid unnecessary nesting • Use same strength specificity
  • 36. @shayhoweModular HTML & CSS USE CLASSES Bad .feat-­‐box  .callout  .pr  {    font-­‐size:  12px; } .feat-­‐box  .callout  .pr  .un  {    color:  #39f; }
  • 37. @shayhoweModular HTML & CSS USE CLASSES Good .feat-­‐box  .price  {    font-­‐size:  12px; } .feat-­‐box  .unit  {    color:  #39f; }
  • 38. @shayhoweModular HTML & CSS USE CLASSES Bad .btn.large  {    font-­‐size:  24px;        padding:  15px  30px; } <div  class="btn  large">...</div>
  • 39. @shayhoweModular HTML & CSS USE CLASSES Good .btn-­‐large  {    font-­‐size:  24px;    padding:  15px  30px; } <div  class="btn-­‐large">...</div>
  • 40. @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
  • 41. @shayhoweModular HTML & CSS PERFORMANCE
  • 42. @shayhoweModular HTML & CSS REUSE CODE • Do not duplicate code • Remove old code • Defer loading subsequent styles
  • 43. @shayhoweModular HTML & CSS REUSE CODE Bad .news  {    background:  #eee;    color:  #666; } .social  {    background:  #eee;    color:  #666; }
  • 44. @shayhoweModular HTML & CSS REUSE CODE Good .news, .social  {    background:  #eee;    color:  #666; } Better .feat-­‐box  {    background:  #eee;    color:  #666; }
  • 45. @shayhoweModular HTML & CSS MINIMIZE REQUEST • Combine like files (CSS & JS) • Use image sprites • Leverage data URIs • Icon fonts
  • 46. @shayhoweModular HTML & CSS IMAGE SPRITES <span  class="icon  i-­‐twitter">...</span> <span  class="icon  i-­‐facebook">...</span> .icon  {    background:  url("icons.png")  0  0  no-­‐repeat; } .i-­‐twitter  {    background-­‐position:  0  -­‐16px; } .i-­‐facebook  {    background-­‐position:  0  -­‐32px; }
  • 47. @shayhoweModular HTML & CSS DATA URIS HTML <img  height="100"  width="660"  alt="Pattern"   src="data:imagepng;base64,..."> CSS .pattern  {    background:  url("data:imagepng;base64,...")          repeat; }
  • 48. @shayhoweModular HTML & CSS COMPRESS & CACHE FILES • Utilize Gzip compression • Losslessly compress images • Cache common files
  • 50. @shayhoweModular HTML & CSS COMPRESS & CACHE FILES
  • 51. @shayhoweModular HTML & CSS COMPRESS & CACHE FILES Original 455kb Optimized 401kb
  • 52. Ships on the Roadstead by Willem van de Velde the Younger
  • 53. @shayhoweModular HTML & CSS GETTING STARTED Build a styleguide • Twitter Bootstrap, Zurb Foundation Review methodologies • OOCSS, SMACSS Test your code • CSS Lint, Inspector, PageSpeed
  • 54.
  • 55. @shayhoweModular HTML & CSS THANK YOU! Questions? @shayhowe http://learn.shayhowe.com http://bit.ly/mod-html-css