--- id: css-styling-links title: "CSS Styling Links" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["styling links", "link states", "a:link a:visited a:hover a:active", "CSS links", "link pseudo-classes", "LVHA order"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.89 created_at: 2026-06-23 updated_at: 2026-06-23 review_reason: "" merge_history: [] tags: ["css", "web", "frontend", "w3schools", "links", "pseudo-classes"] raw_sources: ["https://www.w3schools.com/css/css_link.asp"] applied_in: [] github_commit: "" --- # [[CSS Styling Links]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) HTML links can be styled with many CSS properties depending on their state, and the four link-state pseudo-classes (`:link`, `:visited`, `:hover`, `:active`) must be declared in a specific order for the hover and active styles to take effect. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Links are styleable** β€” links can be styled with many CSS properties, e.g. `color`, `font-family`, `background`, etc. [S1] - **Four link states** β€” `a:link` (a normal, unvisited link), `a:visited` (a link the user has visited), `a:hover` (a link when the user mouses over it), `a:active` (a link the moment it is clicked). [S1] - **Common decoration** β€” `text-decoration` is mostly used to remove underlines from links. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **State-ordering rule** β€” when setting the style for several link states, there are some order rules: `:hover` MUST come after `:link` and `:visited`; `:active` MUST come after `:hover`. [S1] - **Per-state styling** β€” apply distinct property values to each pseudo-class to give feedback on visit/hover/click. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **Styling Links** β€” links can be styled with any CSS property (e.g. `color`, `font-family`, `background`, etc.). In addition, links can be styled differently depending on what state they are in. [S1] **The four link states are:** [S1] - `a:link` β€” a normal, unvisited link - `a:visited` β€” a link the user has visited - `a:hover` β€” a link when the user mouses over it - `a:active` β€” a link the moment it is clicked **Example β€” color per state:** [S1] ```css /* unvisited link */ a:link { color: red; } /* visited link */ a:visited { color: green; } /* mouse over link */ a:hover { color: hotpink; } /* selected link */ a:active { color: blue; } ``` **Note (order rule):** When setting the style for several link states, there are some order rules: `a:hover` MUST come after `a:link` and `a:visited`; `a:active` MUST come after `a:hover`. [S1] **Text Decoration** β€” the `text-decoration` property is mostly used to remove underlines from links: [S1] ```css a:link { text-decoration: none; } a:visited { text-decoration: none; } a:hover { text-decoration: underline; } a:active { text-decoration: underline; } ``` **Background Color** β€” the `background-color` property can be used to specify a background color for links: [S1] ```css a:link { background-color: yellow; } a:visited { background-color: cyan; } a:hover { background-color: lightgreen; } a:active { background-color: hotpink; } ``` The page also notes that links can be styled further with properties such as `font-size`, `font-weight`, `font-family`, and the `cursor` property (with various cursor types) β€” "Not found in source" for the exact code of those additional examples. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) The page's own examples apply color, text-decoration, and background-color across the four link states. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Correctly ordered link-state styling (language: CSS): ```css a:link { color: red; } a:visited { color: green; } a:hover { color: hotpink; } a:active { color: blue; } ``` Remove the underline: ```css a:link { text-decoration: none; } ``` ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) No contradictions found in the source. ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual (μ‹€μ œ 적용 사둀 발견 μ‹œ applied/validated둜 승격 κ°€λŠ₯) - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.89 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[CSS Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CSS Link Buttons]], [[CSS Styling Lists]], [[CSS Text]] - **μ°Έμ‘° λ§₯락:** Referenced when styling anchor elements and giving users visual feedback per link state. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS Styling Links β€” https://www.w3schools.com/css/css_link.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Styling Links" page (Astra wiki-curation, P-Reinforce v3.1 format).