Bootstrap 4 white buttons and input groups with button addons

John Avis by | June 29, 2018 | Bootstrap

Bootstrap 4.x doesn't give you white buttons by default, but sometimes white buttons look better, particularly for something like a search box using an input group with button addon placed on a navbar.
Bootstrap 4.x doesn't give you white buttons by default, but sometimes white buttons look better, particularly for something like a search box using an input group with button addon placed on a navbar.

The outline classes for buttons almost accomplish this but there are some differences in border colours so they don't look quite right.

You can accomplish the perfect style with a new css class which I've called `btn-white` in my example:

.btn-white {
background-color: #fff;
border-color: #ced4da;
color: #212529;
}


And sometimes input groups with button addons look even better if the border between the text box and the button is removed. There's a few CSS overrides that can achieve this look simply:

.input-group > .input-group-append > .btn-white {
border-left: solid 1px #fff;
}

.input-group > .input-group-prepend > .btn-white {
border-right: solid 1px #fff;
}


Here's the final product, with borders (top) and without (bottom).

Bootstrap 4 white buttons and input groups with bu

As a side note, if you are looking for a way to show a magnifying glass without a custom font or image, you can use HTML entity `⌕`. Don't forget to provide a fallback for accessibility.

Related Posts

Bootstrap

Improving Bootstrap 4 modals on small screens

by John Avis | June 27, 2018

Bootstrap modals are great but on small screens they take up more valuable space than necessary.


Bootstrap Responsive Web Design

Responsive collapsing search filters in Bootstrap 4

by John Avis | March 26, 2018

In responsive design there are times when on a mobile screen you want to hide some options with a button to show them, but on a large screen always show these options.


Bootstrap

Bootstrap 4 fixed navbar that hides until page scrolled up

by John Avis | March 8, 2018

Fixed navbars – that stay at the top of the screen at all times – are common and useful, but sometimes annoying as they can block the top part of the page (sometimes obscuring page anchors).

Comments

There are no comments yet. Be the first to leave a comment!

Leave a Comment
Tags
ASP.NET Html Forms ASP.NET MVC ASP.NET Web Forms ASP.NET Web Pages Bootstrap C# Classic ASP Cool Websites Databases eBay and PayPal Electrical Repairs General Hardware HTML/CSS Jquery/Javascript Media Center Mobile Phones Responsive Web Design SEO and Social Networking Web Design Web Development Web Security web+db Website Hosting Windows XP

About me

...mostly about web development and programming, with a little bit of anything else related to the Internet, computers and technology.

Subscribe

Get the latest posts delivered to your inbox.