Chapter 9. Minimizing Markup
View/HTML/CSS : 2008. 3. 23. 15:24
태그 최소화 하기
Descendant Selectors
<div id="sidebar">
<h3>About This Site</h3>
<p>This is my site.</p>
<h3>My Links</h3>
<ul>
<li><a href="archives.html">Archives</a></li>
<li><a href="about.html">About Me</a></li>
</ul>
</div>
#sidebar h3 {
font-family: Georgia, serif;
color: #c63;
border-bottom: 1px solid #ccc;
}
#sidebar ul {
list-style-type: none;
}
#sidebar li {
font-weight: bold;
}
- 하위 태그들의 스타일을 위와 같이 정의하면, 하위 태그들에 굳이 class 속성을 추가하지 않아도 된다.
The Unnecessary <div>
<ul id="nav">
<li><a href="archives.html">Archives</a></li>
<li><a href="about.html">About</a></li>
</ul>
- block 엘리먼트는 굳이 div로 감싸서 스타일을 적용할 필요가 없다.
'View > HTML/CSS' 카테고리의 다른 글
[CSS]그라데이션 배경 사용하기 (2) | 2009.05.22 |
---|---|
XPath Path Expression 문법 (0) | 2009.05.15 |
Chapter 14. Image Replacement (0) | 2008.03.31 |
Chpater 13. Styling Text (0) | 2008.03.31 |
Chapter 10. Applying CSS (0) | 2008.03.26 |
Chapter 9. Minimizing Markup (0) | 2008.03.23 |
Chapter 8. More Lists (0) | 2008.03.23 |
Chapter 7. Anchors (0) | 2008.03.23 |
Chapter 6. Strong, EM and Other Phrase Elements (0) | 2008.03.23 |
Chapter 5. Forms (0) | 2008.03.23 |
Chapter 4. Quatations (0) | 2008.03.23 |