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 trialSethuraman Trichur
8,763 PointsCode Challenge Error : Width Value not getting recognized
In the code challenge the requirement is the main-content class width has to be reduced by 75% of its container. I wrote the below css but still the code challenge throws an error . Please help
.main-content { width : 75% ; }
/* Complete the challenge by writing CSS below */
.title {
font-size : 26px ;
}
h2 {
font-size : 53px ;
}
.main-content {
width : 75% ;
margin-left : 0 ;
}
<!DOCTYPE html>
<html>
<head>
<title>Lake Tahoe</title>
<link rel="stylesheet" href="page.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<header>
<span class="title">Journey through the Sierra Nevada Mountains</span>
<h1>Lake Tahoe, California</h1>
</header>
<div class="main-content">
<p>
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 href="#">Find out more</a>
<h2>Check out all the Wildlife</h2>
<p>
As spawning season approaches, the fish acquire a humpback and protuberant jaw. After spawning, they die and their carcasses provide a feast for gatherings of mink, bears, and Bald eagles.
</p>
<a href="#">See the Wildlife</a>
</div>
</div>
</body>
</html>
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! You're doing great. There's a couple of things to note: First, it didn't ask for any alterations to the margin. It's always a good idea to not do anything the challenge doesn't explicitly ask for. Secondly, and this is what's breaking the challenge.... you have a space between width and the colon after. It should look like this:
.main-content {
width: 75% ; /*note that there's no space here between width and the colon */
}
Hope this helps!
Sethuraman Trichur
8,763 PointsSethuraman Trichur
8,763 PointsThanks Jennifer. That worked. I understand with the margin I was just playing around. But for the width I am still not convinced. In the same challenge "font-size : " that worked well with a space. But it breaks when we use width. So that was strange . BTW in the workspace for sure , width with a space works. Any way that is fine ... Thanks for your help
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherSethuraman Trichur Yes, you're correct. It would be functional. In fact, the reason that I checked and rechecked was because your code looked fine. It passes without the space, but doesn't pass with the space. And I have no idea why. I also left your font-size alone which, as you pointed out, passes the challenge. I can't say why that space breaks the challenge, just that it does