See the picture


Look at the screenshot, why does not there be a mistake that two identical id's are not correct? Because each id can only be used once


Browsers will try their best to render invalid markup. They really are quite tolerant, nowadays. But it is still invalid code and will not pass the W3C validator check.

If you were to write some behavior behind the page (script) you would get unexpected results. That is why it is best to write all the HTML first, then validate it, and only then start to add behaviors. I know you might not be there yet, so just keep this in the back of your mind.

The reason your page passes the exercise is because the lesson checker isn't looking for validation errors.


<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <title>Basic HTML Setup</title>
  <link type="text/css" rel="stylesheet" href="stylesheet.css">
  <div id="serious">
    <h1>Basic HTML Setup</h1>
    <p>This is a very basic HTML page.</p>
  <div id="serious">
    <h1>Invalid id on parent</h1>
    <p>This will not validate.</p>
Error: Duplicate ID serious.

From line 13, column 3; to line 13, column 20
</div>↩  <div id="serious">↩    <

Warning: The first occurrence of ID serious was here.

From line 9, column 3; to line 9, column 20

↩<body>↩  <div id="serious">↩    <


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.