Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Bootstrap - can't add background color to the background image

I want to add color to the picture, it should appear when using bootsrap "bg-info" class but it doesn't, I see only the picture but no color is added.

The code:

<div class="jumbotron jumbotron-fluid bg-info text-white ">
  <div class="container text-sm-center pt-5">
    <div class="row">
      <div class="col-lg-12">
    <h1 class="display-4" pt-5>Lorem ipsum</h1>
    <p class="lead text-uppercase">Lorem ipsum</p>
    <img width="25%;" class="fluid rounded-circle border d-none d-md-block mx-auto" src="Images/linked_e.jpg"  alt="Lorem Ipsum"/>

CSS:

.jumbotron {


background-size: cover;
background-image: url(Images/city.jpeg);

 }

1 Answer

If you are trying to add color over your picture you will need to use a linear-gradient. Also, I'm confused on what class you are trying to add it too when you said "bg-info". You have it right in your code and it should be added to class jumbotron. bg-info should be content. Unless you are building a container inside your jumbotron and you want an image displaying in your bg-info, but still the linear gradient still applies when you want to change the color of any background-image that is added through css.

ex:

background-image: linear-gradient(rgba(53, 66, 74, 0.9), rgba(53, 66, 74, 0.9)), url(Images/city.jpeg);