---
id: howto-css-button-group
title: "How To - Button Group"
category: "Web_Recipes"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["btn-group horizontal CSS"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.82
created_at: 2026-07-04
updated_at: 2026-07-04
review_reason: ""
merge_history: []
tags: ["howto", "css", "w3schools", "buttons"]
raw_sources: ["https://www.w3schools.com/howto/howto_css_button_group.asp"]
applied_in: []
github_commit: ""
---

# [[HOWTO CSS Button Group]]

## 🎯 한 줄 통찰 (One-line insight)
`:not(:last-child) { border-right: none; }` solves a problem unique to adjacent bordered buttons — floating buttons side by side with individual borders would double up the border between each pair (right edge of one touching the left edge of the next), so this `:not()` selector strips the right border from every button EXCEPT the last, leaving a single shared-looking seam between buttons instead of a visibly doubled line. [S1]

## 🧠 핵심 개념 (Core concepts)
- **`float: left` buttons + clearfix** — the same clearfix pattern from the layout recipes, needed here because the button group container would otherwise collapse. [S1]
- **`:not(:last-child) { border-right: none; }`** — prevents double borders between adjacent buttons by removing the right border from all but the final button. [S1]
- **Justified/full-width variant** — set the container to `width: 100%` and give each button an explicit percentage width (`33.3%` for 3 buttons, `25%` for 4) so the group spans the full container width evenly. [S1]

## 📖 세부 내용 (Details)
- Horizontal group: `.btn-group button { float: left; border: 1px solid green; } .btn-group button:not(:last-child) { border-right: none; } .btn-group:after { content: ""; clear: both; display: table; }`. [S1]
- Justified variant: inline `style="width:33.3%"` on each of 3 buttons inside a `width:100%` container. [S1]

## ⚖️ 모순 및 업데이트 (Contradictions & updates)
없음 — 신규 레시피, 기존 문서와 모순되는 내용 없음.

## 🛠️ 적용 사례 (Applied in summary)
Apple/Samsung/Sony 버튼 3개를 이중 테두리 없이 나란히 배치하고, 컨테이너 전체 폭에 맞춰 균등 분할하는 justified 버전도 함께 제시됨. [S1]

## 💻 코드 패턴 (Code patterns)
Button group without doubled borders between buttons (CSS):
```css
.btn-group button {
  float: left;
  border: 1px solid green;
}
.btn-group button:not(:last-child) {
  border-right: none;
}
.btn-group:after {
  content: ""; clear: both; display: table;
}
```

## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual
- **출처 신뢰도:** B (W3Schools — widely used educational reference)
- **신뢰 점수:** 0.82
- **중복 검사 결과:** 신규 생성 (New discovery)

## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[W3Schools HOW TO]]
- **관련 개념:** [[HOWTO CSS Button Group Vertical]], [[HOWTO CSS Block Buttons]]
- **참조 맥락:** CSS Buttons 섹션.

## 📚 출처 (Sources)
- [S1] W3Schools — How To - Button Group — https://www.w3schools.com/howto/howto_css_button_group.asp

## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "How To - Button Group" recipe (Astra wiki-curation, P-Reinforce v3.1 format).
