CSS CSS Basics Getting Started with CSS Inline and Internal Styles

Heather Comer
Heather Comer
1,955 Points

When I type the inline style on the h1 tag, everything turns red starting with the closing quotation mark.

I have typed <h1 style="color: white;">Lake Tahoe, California</h1>

It is acting like the h1 element isn't closed and like style isn't recognized because "style" isn't a different color like it was when I typed the <body style="background...etc. element.

Frank Genova
Frank Genova
Python Web Development Techdegree Student 12,586 Points

Can you post your whole code? I am wondering if there is something in the style section. In the online tutorial, he spends some time doing internal styling to compare how it interacts with inline styling which should over-ride it. Maybe when translating the examples, you've got something going on? From what I see you typed the same thing as what is in the course. So it would be helpful to see this in the larger context. Be sure to use the Markdown Cheatsheet to make your copy past of code show up as HTML.

3 Answers

you forgot to put " before color in style it should be something like this <h1 style="color: white;">Lake Tahoe, California</h1>

Heather Comer
Heather Comer
1,955 Points
<!DOCTYPE html>
<html>
  <head>
    <title>Lake Tahoe</title>
  </head>
  <body style="background-color: orange;"> 
    <header>
      <span>Journey through the Sierra Nevada Mountains</span>
      <h1 style=color: white;">Lake Tahoe, California</h1>
    </header>
    <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>
  </body>
</html>
Heather Comer
Heather Comer
1,955 Points

I closed the workspace and reopened it and then retyped everything. This time, "style" is the right color, but it is still acting like the tag isn't closed.

Dave StSomeWhere
Dave StSomeWhere
19,208 Points

Yep the tag isn't closed - you're missing the opening quote on the h1 style