Movatterモバイル変換


[0]ホーム

URL:


拓樹 谷, profile picture
Uploaded by拓樹 谷
PDF, PPTX42,970 views

モダンなCSS設計パターンを考える

This document discusses modern CSS architecture patterns. It introduces concepts like OOCSS, SMACSS, and BEM for organizing CSS in a modular, scalable and maintainable way. It provides examples of how to build reusable CSS modules and maintain them through techniques like naming conventions, categorization and decoupling CSS from HTML. The presentation emphasizes goals of building predictable, reusable, maintainable and scalable CSS architecture.

Embed presentation

Download as PDF, PPTX
モダンなCSS設計パターンを考えるModern CSS ArchitectureHiroki TaniHTML5 Conference 2013
Hiroki TaniCyberAgent, Inc.
http://frontrend.github.io/Frontrend in SapporoFrontrend in Fukuoka2013年12月7日2013年1月
Why Architecture ?



#news h2 { border-bottom: 1px solid black; padding: 1em 0.5em; font-size: 18px; font-weight: bold;}
#news h2 { border-bottom: 1px solid black; padding: 1em 0.5em; font-size: 18px; font-weight: bold;}#faq .title { border-bottom: 1px solid black; padding: 1em 0.5em; font-size: 18px; font-weight: bold;}
#news h2 { border-bottom: 1px solid black; padding: 1em 0.5em; font-size: 18px; font-weight: bold;}#faq .title { border-bottom: 1px solid black; padding: 1em 0.5em; font-size: 18px; font-weight: bold;}#service .feature .title { border: 1px solid black; padding: 0.5em; font-size: 16px;}
.column_2 #inbox .list { ... }.column_3 #inbox .list { ... }.column_3 #inbox .list .name { ... }.column_3 #inbox .list .name p { ....column_3 #inbox .list .name.reply {.column_3 #inbox .list .name.reply abody#top .column_3 #inbox .list.left}... }{ ... }{ ... }
!important
Goals of Better CSS Architecture- Predictable- Reusable- Maintainable- Scalable予測しやすい再利用しやすい保守しやすい拡張しやすいhttp://enja.studiomohawk.com/2013/07/06/css-architecture/
Modular CSS
OOCSSNicole Sullivanhttps://github.com/stubbornella/oocss/wiki
OOCSS- Separate structure and skin構造と見た目の分離- Separate container and contentコンテナとコンテンツの分離
Media object
<div class="media"> <div class="media-image">  <img src="/img/seminar/15/tani.jpg"> </div> <div class="media-body">  <p>...</p>  <ul>   <li><a>...</a></li>  </ul>  <p>...</p> </div></div>
<div class="media"> <div class="media-image">  <img src="/img/seminar/15/tani.jpg"> </div> <div class="media-body">  <p>...</p>  <ul>   <li><a>...</a></li>  </ul>  <p>...</p> </div></div>
<div class="media"> <div class="media-image">  <img src="/img/seminar/15/tani.jpg"> </div> <div class="media-body">  <p>...</p>  <ul>   <li><a>...</a></li>  </ul>  <p>...</p> </div></div>
.media { /* Clearfix */}.media-image { float: left; margin-right: 10px;}.media-image  img {> display: block;}.media-body { overflow: hidden;}
<div class="media skin-a"> <div class="media-image">  <img src="/img/seminar/15/tani.jpg"> </div> <div class="media-body">  <p>...</p>  <ul>   <li><a>...</a></li>  </ul>  <p>...</p> </div></div>
<div class="media skin-b"> <div class="media-image">  <img src="/img/seminar/15/tani.jpg"> </div> <div class="media-body">  <p>...</p>  <ul>   <li><a>...</a></li>  </ul>  <p>...</p> </div></div>
How to build modules ?
It depends.
Rule of Three‘Refactoring’http://en.wikipedia.org/wiki/Rule_of_three_(computer_programming)
3, 6
3, 6, 9, 12, 15 ...
3, 6, 12, 24, 48 ...
3, 6, 9
3, 6, 9, 12, 15 ...
.fontSize10 { font-size: 10px}.colorRed { color: red}
<p class="fontSize18 colorRed">入力内容に誤りがあります。</p>
<p class="box radius10 fontSize18 colorRed">入力内容に誤りがあります。</p>
.colorRed { color: red}
.colorRed { color: orange;}⚠
.colorRed { color: orange; /* あとで直す */}⚠
.fontSize18 { font-size: 18px}
.fontSize18 { font-size: 18px}@media only screen and (max-width : 320px) { .fontSize18 {  font-size: 14px }}⚠
.radius6 { border-radius:}.radius10 { border-radius:}.radius12 { border-radius:}.radius14 { border-radius:}6px;10px;12px;14px;⚠
How to maintain modules ?
SMACSSJonathan Snookhttp://smacss.com/ja
日本語、ありますSMACSSJonathan Snookhttp://smacss.com/ja
SMACSS- Categorizationカテゴライズ- Naming Convention命名規則- Decoupling CSS from HTMLHTMLとCSSの分離
SMACSS Categories- Base- Layout- State- Theme- Module
/* # Base */body, form {margin: 0;padding: 0;}a {color: #039;}a:hover {color: #03F;}
/* # Layout */#header {width: 960px;margin: auto;}.l-article {border: solid #CCC;border-width: 1px 0 0;}.l-grid {margin: 0;padding: 0;list-style-type: none;}.l-grid > li {display: inline-block;margin: 0 0 10px 10px;}
/* # State */.is-hidden { display: none;}.is-error { font-weight: bold; color: red;}.is-tab-active { border-bottom-color: transparent;}
/* # Theme *//* ## Spring Theme CSS */.theme-header { background-image: url("/theme/spring/header.png");}.theme-border { 1px solid pink;}
Message-boxhttp://cdpn.io/hKBkm
<div class="msg"><p>...</p></div>.msg {display: block;border: 1px solid #cccccc;border-radius: 8px;padding: 1em;background-color: #efefef;color: #333333;}
<div class="msg msg-error"><p>...</p></div>.msg {...}.msg-error {border: 1px solid #c0392b;background-color: #fe9282;}
<div class="msg msg-success"><p>...</p></div>.msg {...}.msg-success {border: 1px solid #27ae60;background-color: #99f3c9;}
<div class="msg msg-error"><h2>...</h2><p>...</p></div>
<div class="msg msg-error"><h2>...</h2><p>...</p></div>.msg h2 {font-size: inherit;font-weight: bold;}.msg p {margin-top: 0.6em;}
.msg h2 {font-size: inherit;font-weight: bold;}.msg ul,.msg p {margin-top: 0.6em;}
.msg h2 {font-size: inherit;font-weight: bold;}.msg ul,.msg p {margin-top: 0.6em;}⚠
<div class="msg msg-error"><h2 class="msg-title">...</h2><ul class="msg-body"><li>...</li><li>...</li></ul></div>
.msg-title {font-size: inherit;font-weight: bold;}.msg-body {margin-top: 0.6em;}
<div class="msg msg-error"><p class="msg-title">...</p><ul class="msg-body"><li>...</li><li>...</li></ul></div>
<div class="msg msg-error"><h2 class="msg-title"><i class="msg-title-icon ico ico-label ico-alert"></i>...</h2><ul class="msg-body"><li>...</li><li>...</li></ul></div>
.msg-title-icon {vertical-align: -0.3em;}.ico {display: inline-block;}.ico-alert {background-image: url(...);width: 24px;height: 24px;}.ico-label {margin-right: 0.3em;}
%ico {display: inline-block;}%ico-alert {background-image: url(...);width: 24px;height: 24px;}%ico-label {margin-right: 0.3em;}.msg-error-icon {vertical-align: -0.3em;@extend %ico;@extend %ico-alert;@extend %ico-label;}

.msg-error {border: 1px solid #c0392b;background-color: #fe9282;}

.msg-title {font-size: inherit;font-weight: bold;}.msg-body {margin-top: 0.6em;}
.msg {...}.msg-error {border: 1px solid #c0392b;background-color: #fe9282;}.msg-title {font-size: inherit;font-weight: bold;}
BEMYandexhttp://bem.info/
BEM stands for ...- Block- Element- Modifier
Block
Element
Modifier
.block { ...}.block__element { ...}.block_modifier { ...}.block__element_modifier { ...}
.nav { ...}.nav__item { ...}.nav_segmented { ...}.nav__item_segmented { ...}
.nav { ...}.nav__item { ...}.nav--segmented { ...}.nav__item--segmented { ...}http://enja.studiomohawk.com/2012/03/20/about-html-semantics-and-front-end-architecture/
.msg {...}.msg--error {border: 1px solid #c0392b;background-color: #fe9282;}
.msg__title {font-size: inherit;font-weight: bold;}.msg__body {margin-top: 0.6em;}.msg__title-icon {vertical-align: -0.3em;}
MCSS- Base- Project- cosmetichttp://operatino.github.io/MCSS/en/
inuit.css- Base- Generic- Objectshttp://inuitcss.com/
SUIT- Utilities- Componentshttps://github.com/suitcss/suit
Front-end Styleguide
Starbucks Style Guidehttp://www.starbucks.com/static/reference/styleguide/
Pattern Primerhttp://patternprimer.adactio.com/
MailChimp Pattern Libraryhttp://ux.mailchimp.com/patterns/
Twitter Bootstraphttp://getbootstrap.com
KSShttp://warpspire.com/kss/styleguides/
Kaleihttp://kaleistyleguide.com/
StyleDoccohttp://jacobrask.github.io/styledocco/
//// # 見出し//// 説明文を書きます。マークダウン形式です。//// ```// <button type="button" class="btn btn-default">//``` で囲んだ部分にデモのHTMLを記述します。// </button>// ```.btn {display: inline-block;...&:hover,&:focus {color: @btn-default-color;text-decoration: none;}}
$ styledocco -n "ProjectName" css/$ styledocco -n "ProjectName" -o "mydocs"$ styledocco -n "ProjectName" --preprocessor "lessc" less/
Building Pages🎬⚏👤 👤
Building Pages🎬⚏👤 👤🎬⚏👤
Building PagesSystems🎬⚏🎬⚏👤 👤👤
Developer vs Designer ?
🎬⚏👤 👤
🎬⚏👤 👤
🎬⚏👤 👤
🎬⚏👤 👤 
🎬⚏👤 👤 
🎬⚏👤 👤 
🎬⚏👤 👤 
Developer with Designer
Best Practice
Best Practices
“どんなに多くの人が貢献したとしてもどのコードも一人で書いたようにするAll code in any code-base should look like a single persontyped it, even when many people are contributing to it.”- Idiomatic CSShttps://github.com/necolas/idiomatic-css
“壊れない完璧な設計を求めるのではなく壊れたときに勇気をもって修復できる設計を- Anonymous”
Thanks.- twitter.com/hiloki- inkdesign.jp- html5experts.jp/hiloki/
Photo credit-http://www.flickr.com/photos/bpotstra/3490333174/sizes/l/http://www.flickr.com/photos/bettybroadbent/3704523854/sizes/o/http://www.flickr.com/photos/drewmaughan/8209503226/sizes/l/http://www.flickr.com/photos/biodork/6849406792/http://www.flickr.com/photos/43266097@N03/9444574320/sizes/l/http://www.flickr.com/photos/90585146@N08/8234225693/sizes/l/http://www.flickr.com/photos/lwr/6778863776/sizes/l/http://www.flickr.com/photos/jezpage/4696962046/http://www.flickr.com/photos/april-mo/8485249298/sizes/l/http://www.flickr.com/photos/4st4roth/2366615948/http://www.flickr.com/photos/sharman/4570412801/sizes/l/http://www.flickr.com/photos/kaptainkobold/3771497484/http://www.flickr.com/photos/laurie_pink/2549598674/sizes/l/http://www.flickr.com/photos/dansdata/3266946102/http://www.flickr.com/photos/ochre_jelly/6839227477/sizes/l/http://www.flickr.com/photos/in-duce/2232109985/sizes/o/http://www.flickr.com/photos/pgoyette/5911926699/sizes/z/http://www.flickr.com/photos/conradoplg/10091603396/sizes/l/http://www.flickr.com/photos/kaptainkobold/4441509147/sizes/l/

Recommended

PDF
モダンなCSS設計パターンを考える
PDF
Beyond CSS Architecture
KEY
Html5 intro
PDF
High Performance Webdesign
PDF
Rapid Prototyping
PPTX
Xlrays online web tutorials
PDF
Try Web Components
PDF
CSSプリプロセッサの取扱説明書
PPTX
Hardcore HTML
PDF
Advanced Web Scraping or How To Make Internet Your Database #seoplus2018
TXT
Guia de-estudio-2
DOC
I pv6+at+caribbean+sector
TXT
Espacios en-tu-vida
PDF
The Backside of the Class (CSS Day 2015)
PDF
Nanoformats
PDF
Doing it in style - creating beautiful sites, the web standards way / WebDD /...
PDF
LessCSS Presentation @ April 2015 GTALUG Meeting
TXT
Capitulo 3-enegia-y-conservacion-de-masas
PDF
WordCamp Bari 2019
TXT
Dorothea orem-theory
KEY
Plone Interactivity
TXT
Html22
PDF
Introducing YUI
PDF
A More Perfect Union with CSS
PDF
Haml, Sass & Compass
PDF
10 Things Webdesigners tend to do Wrong in SEO - SMX 2014
PDF
Class 4 handout w css3 using j fiddle
PDF
10 Things Web Designers tend to forget when doing SEO
PDF
ACSS: Rethinking CSS Best Practices
PDF
Compass And Sass(Tim Riley)

More Related Content

PDF
モダンなCSS設計パターンを考える
PDF
Beyond CSS Architecture
KEY
Html5 intro
PDF
High Performance Webdesign
PDF
Rapid Prototyping
PPTX
Xlrays online web tutorials
PDF
Try Web Components
PDF
CSSプリプロセッサの取扱説明書
モダンなCSS設計パターンを考える
Beyond CSS Architecture
Html5 intro
High Performance Webdesign
Rapid Prototyping
Xlrays online web tutorials
Try Web Components
CSSプリプロセッサの取扱説明書

What's hot

PPTX
Hardcore HTML
PDF
Advanced Web Scraping or How To Make Internet Your Database #seoplus2018
TXT
Guia de-estudio-2
DOC
I pv6+at+caribbean+sector
TXT
Espacios en-tu-vida
PDF
The Backside of the Class (CSS Day 2015)
PDF
Nanoformats
PDF
Doing it in style - creating beautiful sites, the web standards way / WebDD /...
PDF
LessCSS Presentation @ April 2015 GTALUG Meeting
TXT
Capitulo 3-enegia-y-conservacion-de-masas
PDF
WordCamp Bari 2019
TXT
Dorothea orem-theory
KEY
Plone Interactivity
TXT
Html22
PDF
Introducing YUI
PDF
A More Perfect Union with CSS
PDF
Haml, Sass & Compass
PDF
10 Things Webdesigners tend to do Wrong in SEO - SMX 2014
PDF
Class 4 handout w css3 using j fiddle
PDF
10 Things Web Designers tend to forget when doing SEO
Hardcore HTML
Advanced Web Scraping or How To Make Internet Your Database #seoplus2018
Guia de-estudio-2
I pv6+at+caribbean+sector
Espacios en-tu-vida
The Backside of the Class (CSS Day 2015)
Nanoformats
Doing it in style - creating beautiful sites, the web standards way / WebDD /...
LessCSS Presentation @ April 2015 GTALUG Meeting
Capitulo 3-enegia-y-conservacion-de-masas
WordCamp Bari 2019
Dorothea orem-theory
Plone Interactivity
Html22
Introducing YUI
A More Perfect Union with CSS
Haml, Sass & Compass
10 Things Webdesigners tend to do Wrong in SEO - SMX 2014
Class 4 handout w css3 using j fiddle
10 Things Web Designers tend to forget when doing SEO

Similar to モダンなCSS設計パターンを考える

PDF
ACSS: Rethinking CSS Best Practices
PDF
Compass And Sass(Tim Riley)
PDF
Css cheat sheet
KEY
前端开发理论热点面对面:从怎么看,到怎么做?
PDF
CSS- Smacss Design Rule
PDF
Accelerated Stylesheets
PDF
Structuring your CSS for maintainability: rules and guile lines to write CSS
PDF
CSMess to OOCSS: Refactoring CSS with Object Oriented Design
PDF
LESS : The dynamic stylesheet language
PDF
The Future is Modular, Jonathan Snook
PPTX
CSS for Developers
PDF
More of less (take 2)
KEY
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...
PPTX
CSS - chained classes
PDF
UI Realigning & Refactoring by Jina Bolton
KEY
Wrangling the CSS Beast with Sass
PDF
Part 2 in depth guide on word-press coding standards for css &amp; js big
ACSS: Rethinking CSS Best Practices
Compass And Sass(Tim Riley)
Css cheat sheet
前端开发理论热点面对面:从怎么看,到怎么做?
CSS- Smacss Design Rule
Accelerated Stylesheets
Structuring your CSS for maintainability: rules and guile lines to write CSS
CSMess to OOCSS: Refactoring CSS with Object Oriented Design
LESS : The dynamic stylesheet language
The Future is Modular, Jonathan Snook
CSS for Developers
More of less (take 2)
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...
CSS - chained classes
UI Realigning & Refactoring by Jina Bolton
Wrangling the CSS Beast with Sass
Part 2 in depth guide on word-press coding standards for css &amp; js big

More from 拓樹 谷

PDF
メンテナブルでありつづけるためのCSS設計
PDF
CSS設計の理想と現実
PDF
CSS Components
PDF
Thinking about CSS Architecture
PDF
How to Win the Heart of CSS Boys
PDF
Why Sass?
メンテナブルでありつづけるためのCSS設計
CSS設計の理想と現実
CSS Components
Thinking about CSS Architecture
How to Win the Heart of CSS Boys
Why Sass?

Recently uploaded

PDF
Day 1 - Cloud Security Strategy and Planning ~ 2nd Sight Lab ~ Cloud Security...
PDF
Unser Jahresrückblick – MarvelClient in 2025
PDF
The year in review - MarvelClient in 2025
PDF
Day 5 - Red Team + Blue Team in the Cloud - 2nd Sight Lab Cloud Security Class
PPTX
Kanban India 2025 | Daksh Gupta | Modeling the Models, Generative AI & Kanban
PDF
Day 2 - Network Security ~ 2nd Sight Lab ~ Cloud Security Class ~ 2020
PDF
Dev Dives: AI that builds with you - UiPath Autopilot for effortless RPA & AP...
PDF
December Patch Tuesday
 
PDF
Security Technologys: Access Control, Firewall, VPN
PPT
software-security-intro in information security.ppt
PPTX
From Backup to Resilience: How MSPs Are Preparing for 2026
 
PDF
Safeguarding AI-Based Financial Infrastructure
PDF
Accelerating Responsible AI Adoption in Public Sector and Private Organizations.
PDF
Greetings All Students Update 3 by Mia Corp
PPTX
Ethics in AI - Artificial Intelligence Fundamentals.pptx
PDF
Internet_of_Things_IoT_for_Next_Generation_Smart_Systems_Utilizing.pdf
PDF
Decoding the DNA: The Digital Networks Act, the Open Internet, and IP interco...
PPTX
AI's Impact on Cybersecurity - Challenges and Opportunities
PPTX
THIS IS CYBER SECURITY NOTES USED IN CLASS ON VARIOUS TOPICS USED IN CYBERSEC...
PDF
Six Shifts For 2026 (And The Next Six Years)
Day 1 - Cloud Security Strategy and Planning ~ 2nd Sight Lab ~ Cloud Security...
Unser Jahresrückblick – MarvelClient in 2025
The year in review - MarvelClient in 2025
Day 5 - Red Team + Blue Team in the Cloud - 2nd Sight Lab Cloud Security Class
Kanban India 2025 | Daksh Gupta | Modeling the Models, Generative AI & Kanban
Day 2 - Network Security ~ 2nd Sight Lab ~ Cloud Security Class ~ 2020
Dev Dives: AI that builds with you - UiPath Autopilot for effortless RPA & AP...
December Patch Tuesday
 
Security Technologys: Access Control, Firewall, VPN
software-security-intro in information security.ppt
From Backup to Resilience: How MSPs Are Preparing for 2026
 
Safeguarding AI-Based Financial Infrastructure
Accelerating Responsible AI Adoption in Public Sector and Private Organizations.
Greetings All Students Update 3 by Mia Corp
Ethics in AI - Artificial Intelligence Fundamentals.pptx
Internet_of_Things_IoT_for_Next_Generation_Smart_Systems_Utilizing.pdf
Decoding the DNA: The Digital Networks Act, the Open Internet, and IP interco...
AI's Impact on Cybersecurity - Challenges and Opportunities
THIS IS CYBER SECURITY NOTES USED IN CLASS ON VARIOUS TOPICS USED IN CYBERSEC...
Six Shifts For 2026 (And The Next Six Years)

モダンなCSS設計パターンを考える


[8]ページ先頭

©2009-2025 Movatter.jp