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

What's the best way to darken this image?

I have an image that I've put in a div class "entertainment". Within the div this image is the background image, and it has white text on top of it. Unfortunately the image is too bright so that the words blend in to the image too easily.

How can I get better contrast between the image and text? I'm following along with the CSS basics and this is the scenario I'm trying to recreate, but in the video the image used looks darkened/like there's an overlay on top of it. How can I get similar results?

Here's my CSS:

.entertainment {

color : white;
text-align: left;
padding: 18% 24%;
margin: 105px 0 60px;
border-top: 10px solid green;
display: inline-block;
background: #434a52 url('images/guide.jpg') no-repeat center;
background-size:cover;

2 Answers

Try linear-gradient:
background: linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url('images/guide.jpg');

Try adding the filter property to your CSS, like this:

myimage {

filter: brightness(50%);

}