--- id: css-pseudo-classes title: "CSS Pseudo-classes" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["pseudo-classes", "pseudo class", "special state styling", "hover focus active", "structural pseudo-classes"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.85 created_at: 2026-06-23 updated_at: 2026-06-23 review_reason: "" merge_history: [] tags: ["css", "web", "frontend", "w3schools", "selectors", "pseudo-classes"] raw_sources: ["https://www.w3schools.com/css/css_pseudo_classes.asp"] applied_in: [] github_commit: "" --- # [[CSS Pseudo-classes]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) A CSS pseudo-class is a keyword added to a selector to define a style for a special state of an element β€” such as hover, focus, visited links, or position within the document tree. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Definition** β€” a CSS pseudo-class is a keyword that can be added to a selector, to define a style for a special state of an element. [S1] - **Syntax** β€” a single colon followed by the pseudo-class name, attached to a selector. [S1] - **Common use cases** β€” styling on mouse hover, distinguishing visited vs unvisited links, focus states, and form validation states. [S1] - **Interactive pseudo-classes** β€” respond to user actions: `:hover`, `:focus`, `:active`, `:link`, `:visited`. [S1] - **Structural pseudo-classes** β€” select based on document-tree position: `:first-child`, `:last-child`, `:nth-child(n)`, `:lang()`. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **State-based styling** β€” append `:state` to a selector to style a transient or contextual condition rather than a static element. [S1] - **Two families** β€” interactive (user-driven) vs structural (position-driven) pseudo-classes cover the two broad selection needs. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **What is a pseudo-class?** A CSS pseudo-class is a keyword that can be added to a selector, to define a style for a special state of an element. [S1] **Syntax** [S1] ```css selector:pseudo-class-name { CSS properties } ``` **Common use cases** The page identifies common applications including styling on mouse hover, distinguishing visited versus unvisited links, focus states, and form validation states. [S1] **Interactive pseudo-classes (respond to user actions)** [S1] - `:hover` β€” when the mouse is over an element. - `:focus` β€” when an element has focus. - `:active` β€” when an element is being activated. - `:link` β€” unvisited links. - `:visited` β€” visited links. **Structural pseudo-classes (select by document-tree position)** [S1] - `:first-child` β€” first child of a parent. - `:last-child` β€” last child of a parent. - `:nth-child(n)` β€” the nth child of a parent. - `:lang()` β€” elements with a specific language. **All CSS Pseudo-classes (reference table)** Not found in source β€” the tutorial page links to the separate "CSS Pseudo-classes Reference" for the complete list rather than embedding the full table. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) The page describes (rather than ships full code for) common applications: hover styling, visited/unvisited link distinction, focus states, and form-validation states. Detailed worked examples live on the linked interactive and structural pseudo-class pages. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) General pseudo-class syntax (language: CSS): ```css selector:pseudo-class-name { CSS properties } ``` ## βš–οΈ 비ꡐ 및 선택 κΈ°μ€€ (Comparison & decision criteria) - **Interactive vs structural** β€” choose an interactive pseudo-class (`:hover`, `:focus`, `:active`, `:link`, `:visited`) to react to user actions or link state; choose a structural pseudo-class (`:first-child`, `:last-child`, `:nth-child(n)`, `:lang()`) to select by position in the document tree. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) No contradictions found in the source. ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual (μ‹€μ œ 적용 사둀 발견 μ‹œ applied/validated둜 승격 κ°€λŠ₯) - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.85 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[CSS Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CSS Interactive Pseudo-classes]], [[CSS Combinators]], [[CSS Selectors]], [[CSS Pseudo-elements]] - **μ°Έμ‘° λ§₯락:** The entry point for styling special element states (hover/focus/link) and structural positions. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS Pseudo-classes β€” https://www.w3schools.com/css/css_pseudo_classes.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Pseudo-classes" page (Astra wiki-curation, P-Reinforce v3.1 format).