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 trialMacy Morgan
1,948 PointsHelp! How do you add a background-image property and define a linear gradient function as the value?
I am baffled.
/* Complete the challenge by writing CSS below */
.main-header {
width: 100%;
font-size: 100px;
background-image: linear-gradient(left, red, blue);
}
<!DOCTYPE html>
<html>
<head>
<title>Lake Tahoe</title>
<link rel="stylesheet" href="page.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<header id="top" class="main-header">
<span class="title">Journey Through the Sierra Nevada Mountains</span>
<h1 class="main-heading">Lake Tahoe, California</h1>
</header>
<div class="primary-content">
<p class="intro">
Lake Tahoe is one of the most breathtaking attractions located in California. It's home to a number of ski resorts, summer outdoor recreation, and tourist attractions. Snow and skiing are a significant part of the area's reputation.
</p>
<a class="callout" href="#more">Find out more</a>
</div><!-- End .primary-content -->
</body>
</html>
3 Answers
Joseph Krafczynski
5,736 PointsTry changing the "left" value to "to left". I think that will fix your issue.
Austin Whipple
29,725 PointsHi Macy,
A few things to try on this one!
First, you don't need to set any styles for width
or font-size
, so I recommend removing those in case they interfere with you getting credit for a correct challenge response.
Second, the challenge is asking for a linear-gradient
that goes from the bottom to the top, so you'll want the first part of that to be to top
instead of left
.
Third, be sure to pay attention to the colors the challenge is asking you to use. By using red
and blue
instead of those asked for by the challenge, you're setting yourself up for "Bummer!" responses.
Lastly, the challenge also asks you to change when the second color value starts by adding 90%
to it.
I'd recommend quickly reviewing the video and/or this MDN documentation on linear-gradient
and giving it another shot. You're very close! Just a bit stuck on some details.
Brandon Cilla
1,199 PointsThis is what I used:
.main-header { background-image: linear-gradient(to right, #00fa9a 60%, #d3d3d3); }
As for what Austin and Joseph wrote, that should work. However, to avoid confusion, looking at the question and project within the CSS Basic course (Gradient Objectives), there is no indication that you need to do anything complex, or use specific colors, or deg, or px, etc....
I was confused at first, but then looking around on the forums, I realized that the question in the objectives could have been a little better formulated for what was being asked, but that is okay.
If there is a different project, or this was already changed (from a year ago), please disregard my comment.
Austin Whipple
29,725 PointsAustin Whipple
29,725 PointsI've changed your comment to an answer.