- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a "button group" with CSS?
Following is the code to create a button group using CSS −
Example
<!DOCTYPE html> <html> <style> .btnGroup{ display: inline-block; font-size: 0; border: 2px solid darkgreen; box-shadow: 5px 10px 18px rgb(55, 173, 39); } button{ float: left; margin:0px; border:none; padding: 15px; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-weight: bold; font-size: 20px; } button:not(:last-child){ border-right: 2px solid rgb(6, 134, 49); } button:hover{ background:rgb(48, 24, 134); box-shadow: 5px 10px 18px rgb(41, 39, 173); color:white; } </style> <body> <h1>Button Group</h1> <div class="btnGroup"> <button>Facebook</button> <button>Twitter</button> <button>LinkedIn</button> </div> <h2>Hover over the above button group to see hover effects</h2> </body> </html>
Output
The above code will produce the following output −
On hovering above any of the button in the button group −
Advertisements