--- id: howto-css-button-split title: "How To - Split Buttons" category: "Web_Recipes" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["split button dropdown 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", "dropdown"] raw_sources: ["https://www.w3schools.com/howto/howto_css_button_split.asp"] applied_in: [] github_commit: "" --- # [[HOWTO CSS Button Split]] ## π― ν μ€ ν΅μ°° (One-line insight) A "split button" is really just a dropdown menu (`.dropdown:hover .dropdown-content { display: block; }`) whose TRIGGER happens to be a second small button with a caret icon sitting immediately next to a normal action button β the dropdown-reveal mechanism itself (hidden content shown on `:hover`, positioned `absolute` inside a `relative`/`inline-block` wrapper) is identical to any other CSS-only dropdown; the only distinguishing feature is the visual split between "primary action" (left button) and "reveal more options" (right arrow button). [S1] ## π§ ν΅μ¬ κ°λ (Core concepts) - **Font Awesome icon library** β loaded via a `` to a CDN stylesheet, providing the caret-down icon (`fa fa-caret-down`) used as the dropdown trigger. [S1] - **`.dropdown { position: absolute; display: inline-block; }`** β wraps the caret button and the dropdown content together as a positioning anchor. [S1] - **`.dropdown-content { display: none; position: absolute; }`** β the hidden menu, absolutely positioned relative to `.dropdown`. [S1] - **`.dropdown:hover .dropdown-content { display: block; }`** β the reveal mechanism: hovering the wrapper (which contains the caret button) shows the menu β a pure CSS `:hover` toggle, no JavaScript. [S1] - **Shared hover state across both buttons** β `.btn:hover, .dropdown:hover .btn { background-color: #0b7dda; }` keeps the main button's color in sync when the dropdown is open, even though the dropdown itself is only hovered via the caret button. [S1] ## π μΈλΆ λ΄μ© (Details) - HTML: `