--- id: css-button-groups title: "CSS Button Groups" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["button group", "btn-group", "horizontal button group", "vertical button group", "bordered button group", "flex buttons"] 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", "flexbox", "ui"] raw_sources: ["https://www.w3schools.com/css/css3_buttons_groups.asp"] applied_in: [] github_commit: "" --- # [[CSS Button Groups]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) A button group is just a set of buttons wrapped in a `
` that becomes a flex container β€” `display: flex` lays them out, `flex-wrap` lets them break to a new line, and `flex-direction: column` stacks them vertically. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Container = flex** β€” to create a group of buttons, wrap the buttons in a `
` element and add `display: flex;` to that `
`. [S1] - **Responsive wrapping** β€” add `flex-wrap: wrap;` so the buttons wrap onto a new line on small screens. [S1] - **Horizontal vs vertical** β€” the default flex direction is horizontal; add `flex-direction: column;` to display the buttons vertically. [S1] - **Bordered grouping** β€” use the `border` property to create a bordered button group, and remove the duplicated inner border so adjacent buttons share one line. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Wrap-and-flex pattern** β€” `.btn-group { display: flex; }` over a set of `.button` children produces an aligned group without per-button positioning. [S1] - **Collapse duplicate borders** β€” `.btn-group .button:not(:last-child) { border-right: none; }` removes the doubled border between adjacent bordered buttons so the group reads as one bar. [S1] - **Direction switch** β€” the same markup becomes a vertical group purely by setting `flex-direction: column;` on the container. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **CSS Horizontal Button Group** [S1] To create a group of buttons, wrap the buttons in a `
` element, and add `display: flex;` to the `
` element. Also add `flex-wrap: wrap;`, to let the buttons wrap on a new line on small screens: ```css .btn-group { display: flex; flex-wrap: wrap; } .button { background-color: #04AA6D; border: none; color: white; padding: 15px 32px; text-align: center; text-decoration: none; font-size: 16px; cursor: pointer; } .btn-group .button:hover { background-color: dodgerblue; } ``` **CSS Bordered Button Group** [S1] Use the `border` property to create a bordered button group: ```css .button { border: 1px solid green; } .btn-group .button:not(:last-child) { border-right: none; } ``` **CSS Vertical Button Group** [S1] To create a vertical button group, wrap the buttons in a `
` element, and add `display: flex;` to the `
` element. Also add `flex-direction: column;`, to let the buttons be displayed in a vertical way: ```css .btn-group { display: flex; flex-direction: column; } ``` **CSS Animated Buttons** [S1] The source page presents an "CSS Animated Buttons" section with four labelled examples β€” "Add an arrow on hover", "Add a 'pressed' effect on click", "Fade in on hover", and "Add a 'ripple' effect on click". The CSS source for these four examples is only offered behind "Try it Yourself" interactive links and is not present as text on the page. > Code for the four animated-button examples: Not found in source. ## πŸ› οΈ 적용 사둀 (Applied in summary) The page's own examples are the applied cases: a horizontal `.btn-group` of `.button` elements, a bordered variant collapsing the shared border, and a vertical variant. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Horizontal group container (language: CSS): ```css .btn-group { display: flex; flex-wrap: wrap; } ``` Vertical group container (language: CSS): ```css .btn-group { display: flex; flex-direction: column; } ``` Collapse the inner border (language: CSS): ```css .btn-group .button:not(:last-child) { border-right: 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.88 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[CSS Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CSS Buttons]], [[CSS Flexbox]], [[CSS Borders]], [[CSS Pagination]] - **μ°Έμ‘° λ§₯락:** Referenced when grouping related actions (toolbars, segmented controls) into a single visual unit. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS Button Groups β€” https://www.w3schools.com/css/css3_buttons_groups.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Button Groups" page (Astra wiki-curation, P-Reinforce v3.1 format).