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 CSS Basics (2014) Understanding Values and Units Styling the Intro Paragraph

Christopher Flores
Christopher Flores
6,898 Points

Stuck on this one - Basic CSS Challenge Task

Not 100% sure what I'm doing wrong, or if I'm misunderstanding the question.

It asks for the span element nested inside .intro (create a new rule) - am I supposed to give the span tag in html an id tag for intro first?

I tried writing .span too but it didn't accept. Even tried writing it as a new rule/layer in css but no cigar.

Task 4 of 5 (to be specific) Create a new rule that targets the span element inside .intro. Give the span element a bold font weight and an italic font style.

index.html
<!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>Lake Tahoe, California</h1>
    </header>
    <div class="primary-content t-border">
      <p class="intro">
        Lake Tahoe is one of the most <span>breathtaking attractions</span> 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="#more">Find out more</a>
    </div>
    <footer class="main-footer">
      <p>All rights reserved to the state of <a href="#">California</a>.</p>
      <a href="#top">Back to top &raquo;</a>
    </footer>
  </body>
</html>
style.css
/* Complete the challenge by writing CSS below */
.intro,
span {
    font-size: 1.25em;
  line-height: 1.6;
  font-weight: bold;
  font-style: italic;
}

3 Answers

The issue is in the way you are trying to target the span. Your code right now:

.intro,
span {

is treating each of these items individually - the comma tells the browser to look at the intro class, AND separately look at all spans. What you're looking for is

.intro span {

which tells the browser to just look at the span that happens after the intro class.

Christopher Flores
Christopher Flores
6,898 Points

Yeah I'm trying that

now when I click Preview/Refresh to updated the image it says no Preview available and the question still gets marked 'WRONG'... >:(

I don't think I have to write anything in html - just css

for now, I'm just moving on with the course

Ahh! I just ran through the challenge - in your CSS, you need to create a new rule to target the span - in your example code, you have the span tacked onto the original rule you wrote for the intro class.

So instead of this (your original code):

.intro,
span {
    font-size: 1.25em;
  line-height: 1.6;
  font-weight: bold;
  font-style: italic;
}

You need this (with two rules):

.intro {
  font-size: 1.25em;
  line-height: 1.6;
}

.intro span {
  font-weight: bold;
  font-style: italic;
}

Does that make sense?

Christopher Flores
Christopher Flores
6,898 Points

Thanks Noelle,

that worked! Appreciate your help! :)