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

HTML One Solution

Alexandru Vlasnita
Alexandru Vlasnita
5,542 Points

Why is this working?

So i've been adding the CSS links to index, beagle, golden and husky and on beagle i accidentally forgot to close the link:

<link rel="stylesheet" href="../css/style.css"

and the weird part is that is still worked, i even refreshed, closed the tab and opened it again and it had no problem.

Is this supposed to work under normal circumstances?

Arif Ar
Arif Ar
Courses Plus Student 3,717 Points

No it should not work. You are missing something. can you give surrounding line. File name and url of the page which you are checking in the browser

2 Answers

Steven Parker
Steven Parker
231,248 Points

Are you sure the line after this one was not affected? That's where I would expect to see an issue.

And some browsers may tolerate certain syntax errors and still render the page as intended, but this behavior might differ across vendors and versions and should certainly not be relied upon!

Always conform to correct syntax in anything you develop.

Alexandru Vlasnita
Alexandru Vlasnita
5,542 Points

Here is a part of the code, clearly the </head> tag is red but i managed to launch the site perfectly and also refresh it with no problem getting the CSS styles.

<!DOCTYPE html>
<html>
  <head>
    <title>The Dog Paw Blog</title>
    <link rel="stylesheet" href="../css/style.css"
  </head>
  <body>
    <header>
      <nav>
        <ul>
          <!-- 1. Link to the 'index' and 'about' HTML files -->
          <li><a href="../index.html">Home</a></li>
          <li><a href="about.html">About</a></li>
        </ul>
      </nav>
      <h1>About the Dog Paw Blog</h1>
Arif Ar
Arif Ar
Courses Plus Student 3,717 Points

i checked in at the my end and it is also working fine. Than i googled it. They are saying it is the case of browser is ignoring the rule so it can rendered the file as intended. In short although it may work in most of the browser but dont do it.