Bootstrap 4 white buttons and input groups with button addons

John Avis by | June 29, 2018 | Bootstrap Web Development

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

Intermittent "Unable to read data from the transport connection: net_io_connectionclosed" errors

by John Avis | May 6, 2020

If you are having intermittent problems sending email in .NET using System.Net.Mail consider switching libraries.


Bootstrap Icons in Alpha

by John Avis | December 9, 2019

The Bootstrap team have introduced their own open-source icon set.


What's new in Bootstrap 4.4.0 and 4.4.1?

by John Avis | November 27, 2019

Read about the two major improvements in Bootstrap 4.4.0, released 26 November 2019.

Comments

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

Leave a Comment

Tags

About

...random postings about web development and programming, Internet, computers and electronics topics.

I recommend ASPnix for web hosting and Crazy Domains for domain registration.

Subscribe

Get the latest posts delivered to your inbox.