--- id: css-dropdowns title: "CSS Dropdowns" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["dropdown", "CSS dropdown menu", "hover dropdown", "dropdown box", "pure CSS dropdown"] 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", "dropdown", "hover", "menu"] raw_sources: ["https://www.w3schools.com/css/css_dropdowns.asp"] applied_in: [] github_commit: "" --- # [[CSS Dropdowns]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) A CSS dropdown reveals hidden content on hover by combining a `position: relative` wrapper, an absolutely positioned `display: none` content box, and a `:hover` rule that flips it to `display: block` β€” no JavaScript required. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Dropdown** β€” a UI element that displays content (text, links, images) when the user moves over or interacts with a trigger element such as a `div`, `button`, `p`, or `a`. [S1] - **Wrapper positioning** β€” the outer `.dropdown` container is given `position: relative` so the dropdown content can be positioned relative to it. [S1] - **Hidden-by-default content** β€” `.dropdown-content` starts at `display: none` and `position: absolute`, so it does not occupy space until shown. [S1] - **Hover reveal** β€” the `.dropdown:hover .dropdown-content` rule sets `display: block`, exposing the content while the pointer is over the wrapper. [S1] - **Visual depth** β€” a `box-shadow` is used to give the dropdown box a floating, layered appearance. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Relative-parent / absolute-child** β€” pair a `position: relative` wrapper with a `position: absolute` content box so the box anchors to the wrapper. [S1] - **Hover toggle** β€” switch a child from `display: none` to `display: block` via a parent `:hover` descendant selector, achieving show/hide without scripting. [S1] - **Styled trigger button** β€” a `.dropbtn` class styles the trigger (background color, padding, no border, pointer cursor) and changes color on parent hover. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **What is a CSS dropdown?** A CSS dropdown is a UI element that displays content when users click or hover over a trigger element like a button or link. The trigger can be a `div`, `button`, `p`, or `a` tag, and the hidden dropdown content displays on interaction. [S1] **Example 1 β€” Dropdown Box with Text** A basic hoverable dropdown. The parent uses `position: relative`; the `.dropdown-content` is hidden (`display: none`) and absolutely positioned, with a `min-width` of `130px` and a `box-shadow` for depth. The `:hover` selector reveals it: [S1] ```html ``` **Example 2 β€” Dropdown Menu** Extends the dropdown into an interactive menu. A styled `.dropbtn` button (green `#4CAF50` background, white text, `16px` padding) triggers the menu; links inside `.dropdown-content` are block-level with padding and no underline, and change background on hover. The button darkens (`#3e8e41`) when the dropdown is hovered: [S1] ```html ``` ## πŸ› οΈ 적용 사둀 (Applied in summary) The two examples on the page are the applied demonstrations: a text dropdown box and a link-based dropdown menu, both shown as complete self-contained markup. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Core relative-parent / hover-reveal pattern (language: CSS): ```css .dropdown { position: relative; } .dropdown-content { display: none; position: absolute; } .dropdown:hover .dropdown-content { display: block; } ``` ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (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 Advanced Dropdowns]], [[CSS Position]], [[CSS Navigation Bar]] - **μ°Έμ‘° λ§₯락:** Referenced whenever building hoverable menus, tooltips, or pop-over content panels in pure CSS. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS Dropdowns β€” https://www.w3schools.com/css/css_dropdowns.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Dropdowns" page (Astra wiki-curation, P-Reinforce v3.1 format).