--- id: css-button-hover-effects title: "CSS Button Hover Effects" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["button hover", ":hover button", "hoverable buttons", "button shadow", "disabled button", "button width"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.88 created_at: 2026-06-23 updated_at: 2026-06-23 review_reason: "" merge_history: [] tags: ["css", "web", "frontend", "w3schools", "buttons", "hover", "ui"] raw_sources: ["https://www.w3schools.com/css/css3_buttons_hover.asp"] applied_in: [] github_commit: "" --- # [[CSS Button Hover Effects]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) The `:hover` pseudo-class changes a button's appearance on mouse-over, and combined with `transition-duration`, `box-shadow`, `opacity`, and `width` it produces hover, shadow, disabled, and full-width button effects. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`:hover` pseudo-class** β€” used to change the style of a button when you mouse over it. [S1] - **`transition-duration`** β€” added to the base button so the hover change animates smoothly. [S1] - **`box-shadow`** β€” adds a shadow to a button (always-on or on hover). [S1] - **`opacity`** β€” adds transparency to create a "disabled" look (paired with `cursor: not-allowed`). [S1] - **`width`** β€” defines a specific width for a button. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Animated hover** β€” set `transition-duration` on `.button` and override `background-color`/`color` in `.button:hover`. [S1] - **Shadow on hover vs always** β€” `.button1` carries a permanent shadow; `.button2:hover` shows the shadow only on hover. [S1] - **Disabled look** β€” combine reduced `opacity` with `cursor: not-allowed`. [S1] - **Sizing** β€” set width in px (`250px`), percentage of parent (`50%`), or full width (`100%`). [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **Hoverable buttons** β€” the CSS `:hover` pseudo-class is used to change the style of a button when you mouse over it. [S1] ```css .button { transition-duration: 0.4s; } .button:hover { background-color: #4CAF50; /* Green */ color: white; } ``` **Buttons with shadow** β€” the CSS `box-shadow` property is used to add a shadow to a button. `.button1` has a permanent shadow; `.button2` shows a shadow only on hover. [S1] ```css .button1 { box-shadow: 0 8px 16px 0 rgba(0,0,0,0.6); } .button2:hover { box-shadow: 0 8px 16px 0 rgba(0,0,0,0.6); } ``` **Disabled button** β€” the CSS `opacity` property can be used to add transparency to a button (creates a "disabled" look). [S1] ```css .disabledbtn { opacity: 0.6; cursor: not-allowed; } ``` **Button width** β€” the CSS `width` property can be used to define a specific width for a button. By default, the size of a button is determined by its text content. [S1] ```css .button1 { width: 250px; } .button2 { width: 50%; } .button3 { width: 100%; } ``` ## πŸ› οΈ 적용 사둀 (Applied in summary) The page's own examples are the applied cases: an animated `:hover` color swap, permanent vs hover-only `box-shadow`, a `.disabledbtn` style, and fixed/percentage/full-width button widths. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Animated hover color change (language: CSS): ```css .button { transition-duration: 0.4s; } .button:hover { background-color: #4CAF50; color: white; } ``` Show shadow only on hover (language: CSS): ```css .button2:hover { box-shadow: 0 8px 16px 0 rgba(0,0,0,0.6); } ``` ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) No contradictions found in the source. ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual (μ‹€μ œ 적용 사둀 발견 μ‹œ applied/validated둜 승격 κ°€λŠ₯) - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.88 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[CSS Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CSS Styling Buttons]], [[CSS Box Shadow]], [[CSS Pseudo-classes]] - **μ°Έμ‘° λ§₯락:** Referenced when adding interactive hover, shadow, disabled, or width behavior to styled buttons. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS Button Hover Effects β€” https://www.w3schools.com/css/css3_buttons_hover.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Button Hover Effects" page (Astra wiki-curation, P-Reinforce v3.1 format).