4.
Past
이미지 +
간단한 Style sheet 사용.
Ex) Font, Border, Background..
inLine
<table style="border:1px solid red">
<tr>
<td style="color:yellow;font-size:17px">나는 누구 여긴 어디..</td>
</tr>
</table>
5.
Present
이미지를 대체 하는..
Ex) @fant-face, border-radius, gradient, text-shadow...
Javascript를 대체 하는..
Ex) media query, :nth-of-type(), a[href*=naver]…
동적 요소를 대체 하는..
Ex) trasition, animation...
20.
Issue
너무 이른 최적화는 오히려 독?!
기획
디자인
UI개발
개발
정보는 부족하지만..
최적화 진행..
21.
Issue
너무 이른 최적화는 오히려 독?!
기획
디자인
UI개발
개발
정보는 부족하지만..
최적화 진행..
수정 . 수정 . 수정 . 수정
수정 . 수정 . 수정 . 수정
수정 . 수정 . 수정 . 수정
수정 . 수정 . 수정 . 수정
22.
Issue
너무 이른 최적화는 오히려 독?!
기획
디자인
UI개발
개발
최적화 따위.. 다음 플젝에서 보자..
정보는 부족하지만..
최적화 진행..
수정 . 수정 . 수정 . 수정
수정 . 수정 . 수정 . 수정
수정 . 수정 . 수정 . 수정
수정 . 수정 . 수정 . 수정
23.
사이트의 규모가 커질수록.. CSS는 점점 더 비대해짐..
= 유지보수 비용 증가..
= 효율적 관리 & 개발 방법 고민 증가..
“CSS is simple... It’s simple to understand.
But CSS is not simple to use or maintain. ”
http://chriseppstein.github.io/blog/2009/09/20/why-stylesheet-abstraction-matters/
CSS는 단순하고 이해하기 쉽다.
하지만 CSS를 사용하고 관리하기는 쉽지 않다..
24.
Nicole Sullivan Jonathan Snook
Object Oriented CSS
- 2009 -
Scalable and Modular Architecture
for CSS
- 2011 -
25.
OOCSS
코드의 재 사용성을 높이고,
더 빠르고 효율적이며 객체를 추가하기 쉽게..
Object?
독립적인 요소로 추상화 할 수 있는 반복 패턴
<div class="media">
<a href=“#" class="img“><img src=“#" alt="Stubbornella”></a>
<div class="bd">
<a href=“#">@Stubbornella</a>
<span class="detail">14 miniutes ago</span>
</div>
</div>
26.
Two Main Principles
1. Separate structure and skin
표현과 구조의 분리
2. Separate container and content
컨테이너와 콘텐츠의 분리
28.
Two Main Principles
표현과 구조의 분리
거의 모든 웹사이트는 반복되는 요소를 가지고 있음.
(ex. 색상, 그림자, 선, 구조 등..)
29.
Two Main Principles
표현과 구조의 분리
거의 모든 웹사이트는 반복되는 요소를 가지고 있음.
(ex. 색상, 그림자, 선, 구조 등..)
Positioning
(ex. position, float, margin...)
Styling
(ex. background, color, border...)
30.
Two Main Principles
표현과 구조의 분리
거의 모든 웹사이트는 반복되는 요소를 가지고 있음.
(ex. 색상, 그림자, 선, 구조 등..)
Object
Positioning
(ex. position, float, margin...)
Styling
(ex. background, color, border...)
31.
Two Main Principles
표현과 구조의 분리
거의 모든 웹사이트는 반복되는 요소를 가지고 있음.
(ex. 색상, 그림자, 선, 구조 등..)
Mix & Match
Positioning
(ex. position, float, margin...)
Styling
(ex. background, color, border...)
Object
40.
Two Main Principles
표현과 구조의 분리
<style type="text/css">
/* Positioning */
.mod{overflow:hidden}
.modImg{float:left;width:140px;margin-right:10px}
.modImg-title{display:block}
.mod>li{margin-bottom:7px}
.modB-desc{margin:5px 0 10px;display:block}
.modImg-img{display:block}
.ly-mod{width:250px}
.ly-modImg{position:relative;display:block}
.ly-modImg-title{position:absolute;bottom:0;left:0;padding:6px 7px 6px 9px}
.modlist-clear{clear:left;padding-top:5px}
.dualImg{margin-right:22px}
/* Styling */
.link{color:#000063;font-weight:bold;letter-spacing:-1px}
.slink{font-size:14px}
.blink{font-size:24px}
.blink-desc{color:#4F4F4F;font-size:12px;font-weight:normal;line-height:1.4}
.img-link{color:#4f4f4f}
.img-link-desc{color:#4f4f4f;line-height:1.4}
.ly-link-desc{color:#fff;background-color:#000;opacity:0.65}
</style>
41.
Two Main Principles
표현과 구조의 분리
CSS 추가 없이 조합을 통해 구현.
그리고 더 많은 형태를 표현 가능..
<ul class="mod">
<li class="modImg">
<a href="#" class="img-link">
<img src="#" width="140" height="85" alt="" class="modImg-img">
<span class="modImg-title img-link-desc">text</span>
</a>
</li>
<li><a href="#" class="link slink">text</a></li>
<li><a href="#" class="link slink">text</a></li>
<li><a href="#" class="link slink">text</a></li>
<li><a href="#" class="link slink">text</a></li>
<li><a href="#" class="link slink">text</a></li>
</ul>
42.
Two Main Principles
표현과 구조의 분리
CSS 추가 없이 조합을 통해 구현.
그리고 더 많은 형태를 표현 가능..
<ul class="mod">
<li class="modImg ly-mod">
<a href="#" class="img-link ly-modImg">
<img src="#" width="250" height="170" alt="" class="modImg-img">
<span class="modImg-title ly-modImg-title ly-link-desc">text</span>
</a>
</li>
<li class="modB">
<a href="#" class="link blink">
text
<span class="modB-desc blink-desc">text</span>
</a>
</li>
<li><a href="#" class="link slink">text</a></li>
<li><a href="#" class="link slink">text</a></li>
<li><a href="#" class="link slink">text</a></li>
<li><a href="#" class="link slink">text</a></li>
</ul>
43.
Two Main Principles
표현과 구조의 분리
CSS 추가 없이 조합을 통해 구현.
그리고 더 많은 형태를 표현 가능..
<ul class="mod">
<li class="modImg dualImg">
<a href="#" class="img-link">
<img src="#" width="140" height="85" alt="" class="modImg-img">
<span class="modImg-title img-link-desc">text</span>
</a>
</li>
<li class="modImg">
<a href="#" class="img-link">
<img src="#" width="140" height="85" alt="" class="modImg-img">
<span class="modImg-title img-link-desc">text</span>
</a>
</li>
<li class="modlist-clear"><a href="#" class="link slink">text</a></li>
<li><a href="#" class="link slink">text</a></li>
<li><a href="#" class="link slink">text</a></li>
<li><a href="#" class="link slink">text</a></li>
</ul>
46.
Two Main Principles
컨테이너와 콘텐츠의 분리
Dom의 위치에 상관 없이
객체의 재사용을 허용하기 위한 규칙
위치에 의존하지 않고 재사용이 가능한 클래스 기반 모듈 구축,
어떤 컨테이너에도 종속되지 않는…
47.
Two Main Principles
컨테이너와 콘텐츠의 분리
Class명이 영역의 의미를 가지게 되면
재 활용성이 떨어지게 되고 불필요한 코드의 양이 늘어나게 됨.
http://brettjankord.com/2013/02/09/thoughts-on-semantic-html-class-names-and-maintainability/
Class명은 마이크로 포맷을 제외하고
검색 엔진 또는 스크린리더에서 의미있는 정보를 제공하지 않음.
유연하고 재 사용이 가능한 형태로 사용하는 것이 좋음.
50.
Implementation
유의 사항
파생된 CSS Selector는 사용을 금지.
.box a
ID Selector 사용 금지
#box
Element Selector 사용 금지
div.box
!important 사용 금지
유동형으로 객체를 생성하라.
둥근 코너 박스 사용 주의
배경이 가변적이거나 gradient 요소가 있을 경우
51.
Implementation
유의 사항
background-color:red
파생된 CSS Selector는 사용을 금지.
.box a
ID Selector 사용 금지
#box
!important 사용 금지
유동형으로 객체를 생성하라.
둥근 코너 박스 사용 주의
배경이 가변적이거나 gradient 요소가 있을 경우
Element Selector 사용 금지
div.box
52.
Implementation
유의 사항
파생된 CSS Selector는 사용을 금지.
.box a
ID Selector 사용 금지
#box
!important 사용 금지
유동형으로 객체를 생성하라.
둥근 코너 박스 사용 주의
배경이 가변적이거나 gradient 요소가 있을 경우
Element Selector 사용 금지
div.box
53.
Implementation
유의 사항
CSS Lint를 사용하여 쉽게 검증하기!
https://github.com/CSSLint/csslint/wiki/Rules
58.
SMACSS
CSS의 유연성과 관리의 효율성을 높이자..
No Download
No install
No framework
Style Guide!!
59.
Core
1. Base
CSS의 기본 요소
2. Layout
페이지를 분할 요소
3. Module
스타일 재사용을 위한 요소
4. State
상태와 관련된 요소 (활성or 비활성, 숨김 or 확장)
5. Theme
사이트의 전반적인 look and feel의 제어
60.
Naming convention
1. Base
규칙 X
2. Layout
l–, layout-, grid-
3. Module
대 다수가 모듈 , prefix 불필요.
4. State
is-
5. Theme
override
61.
Naming convention
<style type="text/css">
/* Example Module */
.example { }
/* Callout Module */
.callout { }
/* Callout Module with State */
.callout.is-collapsed { }
/* Form field module */
.field { } /
/* Inline layout */
.l-inline { }
</style>
1. Base
규칙 X
2. Layout
l–, layout-, grid-
3. Module
대 다수가 모듈 , prefix 불필요.
4. State
is-
5. Theme
override
62.
Naming convention
<style type="text/css">
/* Example Module */
.example { }
/* Callout Module */
.callout { }
/* Callout Module with State */
.callout.is-collapsed { }
/* Form field module */
.field { } /
/* Inline layout */
.l-inline { }
</style>
1. Base
규칙 X
2. Layout
l–, layout-, grid-
3. Module
대 다수가 모듈 , prefix 불필요.
4. State
is-
5. Theme
override
반드시 지켜야 하는 규칙 X, But...
64.
Core
Base
CSS의 기본 요소를 정의, 모든 요소에 적용되는 기본 스타일.
- ID or Class 없음
- !important 사용 금지
- 단일 element selector 사용 가능
- attribute selectors, pseudo-class selectors, child selectors, sibling selectors
65.
Core
Base
CSS의 기본 요소를 정의, 모든 요소에 적용되는 기본 스타일.
- ID or Class 없음
- !important 사용 금지
- 단일 element selector 사용 가능
- attribute selectors, pseudo-class selectors, child selectors, sibling selectors
<style type="text/css">
html, body, form { margin: 0; padding: 0 }
input[type=text] { border: 1px solid #999}
a { color: #039}
a:hover { color: #03C }
</style>
Reset CSS !
크로스 브라우징을 위해 일관된 기준을 정의하는 목적으로 사용되는 CSS..
67.
Core
Layout
페이지 분할 요소, Layout 내 하나 이상의 모듈을 함께 구성하여 사용
- 유일하게 ID 사용! (재활용이 불가능한 Layout에만 사용 가능. 그 외..Class 사용)
- 사이트 내 레이아웃 변경이 필요한 경우 Class 추가하여 제어 Ex) .l-fippde #aside
69.
Core
Module
재사용을 위한 요소 , 독립형 Component로 설계 필요
- ID Selector 사용 금지
- Element Selector 사용 금지
- 위치 기반의 Styling 금지
<style type="text/css">
.pod { width: 100% }
.pod input[type=text] {width: 50% }
.pod-constrained input[type=text] {width: 100% }
.pod-callout {width: 200px }
.pod-callout input[type=text] {width: 180px }
</style>
71.
Core
State
상태와 관련된 요소 (활성or 비활성, 숨김 or 확장)
- !important 사용 가능
- Layout or Module에 사용 가능한가?
- 자바 스크립트에 의존적인 스타일인가?
<style type="text/css">
/* Module */
.tab {background-color: purple; color: white}
/* State */
.is-tab-active { background-color: white; color: black }
</style>
72.
Core
State
상태와 관련된 요소 (활성or 비활성, 숨김 or 확장)
- !important 사용 가능
- Layout or Module에 사용 가능한가?
- 자바 스크립트에 의존적인 스타일인가?
<style type="text/css">
/* Module */
.tab {background-color: purple; color: white}
/* State */
.is-tab-active { background-color: white; color: black }
</style>
73.
Core
State
상태와 관련된 요소 (활성or 비활성, 숨김 or 확장)
- !important 사용 가능
- Layout or Module에 사용 가능한가?
- 자바 스크립트에 의존적인 스타일인가?
<style type="text/css">
/* Module */
.tab {background-color: purple; color: white}
Class Name
Javascript에 의존적인 방법
Pseudo-class
Ex) .btn:hover, .btn:focus
Media Query
Ex) @media screen and (max-width: 400px)
/* State */
.is-tab-active { background-color: white; color: black }
</style>
75.
Core
Theme
사이트의 전반적인 look and feel 제어, 대부분의 사이트는 불필요, XE는?
- Layout, Font, Color...
- Class??? file!!!
- 다국어 사이트 진행 시 폰트 변경 진행
<style type="text/css">
// in module-name.css
.mod { border: 1px solid; }
</style>
<style type="text/css">
// in theme.css
.mod { border-color: blue; }
</style>
76.
Core
Theme
사이트의 전반적인 look and feel 제어, 대부분의 사이트는 불필요, XE는?
- Layout, Font, Color...
- Class??? file!!!
- 다국어 사이트 진행 시 폰트 변경 진행
<style type="text/css">
// in module-name.css
.mod { border: 1px solid; }
</style>
<style type="text/css">
// in theme.css
.mod { border-color: blue; }
</style>
77.
Core
Theme
사이트의 전반적인 look and feel 제어, 대부분의 사이트는 불필요, XE는?
- Layout, Font, Color...
- Class??? file!!!
- 다국어 사이트 진행 시 폰트 변경 진행
<style type="text/css">
// in module-name.css
.mod { border: 1px solid; }
</style>
<style type="text/css">
// in theme.css
.mod { border-color: blue; }
</style>
78.
Core
Theme
사이트의 전반적인 look and feel 제어, 대부분의 사이트는 불필요, XE는?
- Layout, Font, Color...
- Class??? file!!!
- 다국어 사이트 진행 시 폰트 변경 진행
<style type="text/css">
// in module-name.css
.mod { border: 1px solid; }
</style>
<style type="text/css">
// in theme.css
.mod { border-color: blue; }
</style>
79.
Core
Theme
사이트의 전반적인 look and feel 제어, 대부분의 사이트는 불필요, XE는?
- Layout, Font, Color...
- Class??? file!!!
- 다국어 사이트 진행 시 폰트 변경 진행
<style type="text/css">
// in module-name.css
.mod { border: 1px solid; }
</style>
<style type="text/css">
// in theme.css
.mod { border-color: blue; }
</style>
80.
effect
효과
유형을 체계적으로 정리
유사 유형의 재 사용
코드량 감소, 유지보수 비용 절감, UX의 일관성 유지
81.
Implementation
유의 사항
1. Element Selector는 피하라.
.box a
2. ID Selector는 피하라.
.box a
3. 위치 기반의 Styling 을 피하라.
.pod . pod-constrained
4. Selector의 Depth 최소화
<style type="text/css">
#sidebar div, #footer div { …}
#sidebar div h3, #footer div h3 {… }
#sidebar div ul, #footer div ul {…}
</style>
82.
Implementation
유의 사항
1. Element Selector는 피하라.
.box a
2. ID Selector는 피하라.
.box a
3. 위치 기반의 Styling 을 피하라.
.pod . pod-constrained
4. Selector의 Depth 최소화
<style type="text/css">
.pod {... }
.pod > h3 { ... }
.pod > ul { ... }
</style>
83.
Implementation
유의 사항
1. Element Selector는 피하라.
.box a
2. ID Selector는 피하라.
.box a
3. 위치 기반의 Styling 을 피하라.
.pod . pod-constrained
4. Selector의 Depth 최소화
5. right Selector Class이름 사용
.pod . Ls-pod
88.
common
방법론의 공통적인 이야기..
CSS 코드의 재사용 모듈, 객체
성능 , 유지보수
89.
common
10 BEST PRACTICES
1. Create a component
2. Use consistent semantic styles
3. Design modules to be transparent
on the inside.
4. Be flexible.
5. Learn to love grids.
6. Minimize selectors library
7. Separate structure and skin
8. Separate container and content
9. Extend objects by applying multiple
classes to an element
10. Use reset and fonts from YUI
9 PITFALLS
1. Location dependent styles.
2. Avoid specifying what tag a class applies.
3. Avoid IDs to style inside the main
content areas.
4. Avoid drop shadows and rounded corners
over irregular backgrounds.
5. Don’t sprite every image together
(unless your has very few pages).
6. Avoid height alignment
7. Text as text, not as images.
8. Redundancy
9. Avoid premature optimization.
방법론의 공통적인 이야기..
90.
common
10 BEST PRACTICES
1. Create a component
2. Use consistent semantic styles
3. Design modules to be transparent
on the inside.
4. Be flexible.
5. Learn to love grids.
6. Minimize selectors library
7. Separate structure and skin
8. Separate container and content
9. Extend objects by applying multiple
classes to an element
10. Use reset and fonts from YUI
9 PITFALLS
1. Location dependent styles.
2. Avoid specifying what tag a class applies.
3. Avoid IDs to style inside the main
content areas.
4. Avoid drop shadows and rounded corners
over irregular backgrounds.
5. Don’t sprite every image together
(unless your has very few pages).
6. Avoid height alignment
7. Text as text, not as images.
8. Redundancy
9. Avoid premature optimization.
방법론의 공통적인 이야기..
1. 컴포넌트 라이브러리 제작
2. 모듈은 유동적으로
3. 셀렉터는 간단하게
4. 구조와 표현을 분리
5. 컨테이너와 컨텐츠를 분리
6. class를 조합을 통해 디자인 구현
7. 위치에 의존하는 스타일 사용을 피하자
8. Element Selector는 사용을 피하자
9. 메인 컨텐츠 내에 ID Selecotr 사용을 피하자.
10. 너무 빠른 최적화는 금물.
96.
방법론의 공통적인 이야기..
기획 디자인 UI개발 개발
common
CSS 모듈화 진행에 도움
사전 작업을 통해 빠른 개발 가능
Prototype 생성 용이
97.
common
10 BEST PRACTICES
1. Create a component
2. Use consistent semantic styles
3. Design modules to be transparent
on the inside.
1. 컴포넌트 라이브러리 제작
2. 모듈은 유동적으로
3. 셀렉터는 간단하게
4. 구조와 표현을 분리
5. 컨테이너와 컨텐츠를 분리
6. class를 조합을 통해 디자인 구현
7. 위치에 의존하는 스타일 사용을 피하자
8. Element Selector는 사용을 피하자
9. 메인 컨텐츠 내에 ID Selecotr 사용을 피하자.
10. 너무 빠른 최적화는 금물.
11. UI 컴포넌트 제작에 참여하고 효율적으로 CSS개발 진행
4. Be flexible.
5. Learn to love grids.
6. Minimize selectors library
7. Separate structure and skin
8. Separate container and content
9. Extend objects by applying multiple
classes to an element
10. Use reset and fonts from YUI
9 PITFALLS
1. Location dependent styles.
2. Avoid specifying what tag a class applies.
3. Avoid IDs to style inside the main
content areas.
4. Avoid drop shadows and rounded corners
over irregular backgrounds.
5. Don’t sprite every image together
(unless your has very few pages).
6. Avoid height alignment
7. Text as text, not as images.
8. Redundancy
9. Avoid premature optimization.
방법론의 공통적인 이야기..
재사용을 할 때 CSS 우선순위를 조정 해야하거나 또는 important를 사용하여 CSS의 우선순위 계산을 어렵게 만드는 사례가 발생할 수 있음
한 개의 리스트를 표현하는데는 문제가 없으나 구조가 변경된 새로운 리스트가 동일한 디자인으로 구현되기를 원한다면
작업을 시작하면서 부족한 정보 내에서 CSS를 재사용이 가능하도록 동일한 형태로 정리해가며 최적화를 진행합니다.
새로운 디자인형태 기획 변경 요소의 유입으로 인해 수정 콤보진행
수정을 하다보니 작업속도가 더뎌지고 새로운 디자인 물량은 넘쳐나고 개발에서는 산출물을 독촉하고….최적화 따위…바이바이..나부터 살자..
이런 고민은 이미 많은 사람들이 앞서서 하고 있었고 고민에 대한 솔루션을 이야기 해보자
두가지의 큰 원칙
이런 작업을 설리반을 레고를 조립하는 것과 비슷하다고 표현함.
Class를 객체화 하여 객체의 조합으로 디자인을 구현하게 되면 스타일 시트 추가 없이 더 다양한 화면의 구축이 가능하고 . cSS의 파일 용량도 감소하게 됩니다.
세가지의 리스트를 표현할 수 있는 모듈을 만들었다, 해당 모듈을 활용하여
이렇듯 표현과 구조의 분리로 인해 CSS의 용량은 감소 시키고 더 다양한 디자인을 조합을 통해 표현할 수 있었습니다.
앞서 이야기한 CSS의 규칙을 추가해야하는 나쁜 습관 중 하나로 의미있는 class명을 사용하는 방식을 이야기 햇는데요 그와 동일하게 의미있는 class명을 사용하거나 element selector를 사용한경우 모듈의 의미가 변경되거나 Tag가 변경 되었을때 재사용이 어렵게 됩니다. 컨테이너 종속이란? 상위 CSS Selector에 국한되어 Style을 지정하지 않고 독립적인 요소를 사용해야한다는 이야기 입니다. 상위 CSS Selector에 국한되게 되면 컨테이너간 재사용은 어렵게 되기 때문입니다.
미디어 오브젝트 사용 시 페이스 북의 수백줄의 코드를 감소 시킬 수 있고 이 내용을 페이스 북 UI메니저에게 메일로안내를 햇고 긍정적인 피드백을 받았음. 그로인해 약 CSS는 19% 정도 감소 HTML은 45% 정도 감소 OOCSS를 사용하면 전체적인 코드 감소와 함께 중복 코드 사용으로 인해 개발을 더욱 효율적으로 할 수 있을것으로 생각됩.
우리는 보통 한 개의 CSS 파일의 생성, 그리고 하단에 새로운 CSS계속 쌓게 되면 향후 유지보수도 어렵고 담당자 변경시에도 문제가 발생 그래서 SMACSS는 CSS를 규칙에 맞게 분류함. CSS를 규칙에 맞게 분류하면서 새로운 패턴이 생기고 그 패턴들을 활용하여 도 나은 방법으로 개발이 가능하다.
SMACSS는 여전히 바전중 15불 결제를 통해 효율적인 개발을 할수 있다면 투자가 아깝지 않을듯 합니다.^^
이 디자인 가이드는 UI개발자라면 누구든지 한번쯤은 본 화면일듯.. 이 디자인 가이드는 디자이너는 UI개발자의 편의성을 위하여 UI개발자는 정확한 디자인을 요하는 디자이너를 위한 가이드라고 생각하는듯..
실제 앞서 이야기 한것들을 토데로 본다면 보다 좋은 CSS개발을 위해 우리에게 필요로 하는 것은 이런 디자인 가이드가 아님..
사이트의 전반적인 내용을 이해할 수 있고 모듈화 하기 좋은 구성요소들을 정리해 둔 가이드가 CSS개발에는 훨씬 도움이 됨.
사이트의 전반적인 내용을 이해할 수 있고 모듈화 하기 좋은 구성요소들을 정리해 둔 가이드가 CSS개발에는 훨씬 도움이 됨.
사이트의 전반적인 내용을 이해할 수 있고 모듈화 하기 좋은 구성요소들을 정리해 둔 가이드가 CSS개발에는 훨씬 도움이 됨.
사이트의 전반적인 내용을 이해할 수 있고 모듈화 하기 좋은 구성요소들을 정리해 둔 가이드가 CSS개발에는 훨씬 도움이 됨.
It appears that you have an ad-blocker running. By whitelisting SlideShare on your ad-blocker, you are supporting our community of content creators.
Hate ads?
We've updated our privacy policy.
We’ve updated our privacy policy so that we are compliant with changing global privacy regulations and to provide you with insight into the limited ways in which we use your data.
You can read the details below. By accepting, you agree to the updated privacy policy.