가장 많이 묻는 면접 질문과 답변 & 온라인 테스트
면접 준비, 온라인 테스트, 튜토리얼, 라이브 연습을 위한 학습 플랫폼

집중 학습 경로, 모의고사, 면접 준비 콘텐츠로 실력을 키우세요.

WithoutBook은 주제별 면접 질문, 온라인 연습 테스트, 튜토리얼, 비교 가이드를 하나의 반응형 학습 공간으로 제공합니다.

Chapter 2

CSS Syntax, Selectors, Declarations, Comments, and File Organization

Learn the basic structure of CSS rules and how selectors and declarations work in maintainable stylesheets.

Inside this chapter

  1. Basic CSS Rule Structure
  2. Common Selectors
  3. External, Internal, and Inline CSS
  4. Comments and Readability
  5. Organizing Stylesheets
  6. Practical Example

Series navigation

Study the chapters in order for the clearest path from CSS basics and styling foundations to advanced layout, responsive design, architecture, and maintainable interface systems. Use the navigation at the bottom to move smoothly through the full tutorial series.

Tutorial Home

Chapter 2

Basic CSS Rule Structure

h1 {
  color: #1f3a5f;
  font-size: 32px;
}

A CSS rule has a selector and a declaration block. The selector chooses which elements are targeted. The declaration block contains property-value pairs that define how those elements should appear.

Chapter 2

Common Selectors

  • Element selectors such as p or h1
  • Class selectors such as .card
  • ID selectors such as #mainHeader
  • Attribute selectors such as input[type="email"]
  • Combinators such as descendant or child selectors
Chapter 2

External, Internal, and Inline CSS

Professional projects usually prefer external stylesheets because they are reusable and easier to maintain. Internal CSS is useful for quick demos or isolated pages. Inline styles should be limited because they mix presentation directly into markup and can make code harder to manage.

Chapter 2

Comments and Readability

/* Primary hero heading styles */
.hero-title {
  font-size: 48px;
}

Comments should explain intent or structure when helpful, not restate obvious property lines. Good naming and grouping are just as important as comments.

Chapter 2

Organizing Stylesheets

Students should build the habit of grouping related rules, keeping selectors readable, and organizing CSS in a way that mirrors page structure or component structure rather than letting styles become an unstructured long file.

Chapter 2

Practical Example

A landing page stylesheet may group rules into header, hero, features, testimonials, pricing, and footer sections. That kind of organization helps teams change designs without hunting through scattered declarations.

Copyright © 2026, WithoutBook.