Web Page Doesn't Open

<!DOCTYPE html>
<html lang="en">
#spaceship {background-color;#AADCFF}

<div id="spaceship">
<p>Do or do not...there is no try.</p> 
</div>

<div id="spaceship"> 
  <p>Do or do not...there is no try.</p> 
  <p>Another way to style an element</p>
  <p>by name is by using an ID selector</p>
  <p>where the element we wish</p>
  <p>to style has an id attribute </p>
</div>
</html>

I am new to this HTML stuff and I wonder why when I Control-Click on the page in VSC, I get thisunwanted
when I want this


in other words, I don’t get the corresponding web page. Why not?

Is the file extension of your file .htm or .html? Also, your CSS needs to be inside a style tag.

I was horrified to find that the file was a text file ! No wonder I could’t get a corresponding web page ! Once I saved it as an .html file, all worked out as it should. And yes, of course the style has to be within style tags - thanks for pointing that out.

1 Like