Bootstrap 4 card with outline headers and footers

John Avis by | December 22, 2016 | Bootstrap Web Development

If you use Bootstrap 4 cards and apply one of the outline classes to add some colour you will find the header and footer are still grey, which doesn't look right.
If you use Bootstrap 4 cards and apply one of the outline classes to add some colour you will find the header and footer are still grey, which doesn't look right.

This is how they look:

Bootstrap 4 card outline - before

Personally I think the header and footer should receive the same colour as the outline class.

The Bootstrap team have already said no to this when it was suggested on GitHub.

Fortunately it is simple to apply some other Bootstrap classes to achieve the desired result. Add the corresponding bg-* class and "text-white".

Example:

<div class="card card-outline-danger">
<div class="card-header bg-danger text-white">
Header
</div>
<div class="card-block">
The quick brown fox jumps over the lazy dog
</div>
<div class="card-footer bg-danger text-white">
Footer
</div>
</div>

And this is how cards can look now:

Bootstrap 4 card outline - after

Much better, right?

Related Posts

What's new in Bootstrap v5

by John Avis | December 22, 2020

There are many changes in Bootstrap v5, but these are some of the stand-out changes I noticed when updating a website to v5.


How to use the new Bootstrap Icons v1.2 web font

by John Avis | December 12, 2020

With the release of Bootstrap Icons v1.2, there is now an easy-to-use web font. Here's how you can use the new web font in your web pages.


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.

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.