Bootstrap 4 white buttons and input groups with button addons

johna 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.

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

Web Development

How to set up a debugging using the Turnkey Linux LAMP stack and VS Code

by johna | December 19, 2023
The second part in my guide to setting up a website and database using the Turnkey Linux LAMP stack.

Website Hosting Web Development

How to set up a website and database using the Turnkey Linux LAMP stack

by johna | November 18, 2023
If you need to host your own website for the purposes of web development, Turnkey Linux LAMP Stack is an easy to install all-in-one solution that you can set up on a spare computer or a VM (Virtual Machine).

Bootstrap

How I use the new Bootstrap Icons web font

by johna | January 7, 2022
But using a free online tool, you can create your own web font with just the Bootstrap icons you need.

Comments

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

Leave a Comment

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.