Can someone explain this to me? (html)


#1

I can’t seem to understand what I’m doing wrong with this code:

<!DOCTYPE html>
<html>
  <head>
    <title>Brown Bears</title>
  </head>
  <body>
    <h1>The Brown Bear</h1>
    <div> 
    id='introduction'
     
    <h2>About Brown Bears</h2>
    <h3>Species</h3>
    <h3>Features</h3>
    </div>
    <h2>Habitat</h2>
    <h3>Countries with Large Brown Bear Populations</h3>
    <h3>Countries with Small Brown Bear Populations</h3>
    <h2>Media</h2>
  </body>
</html>

I thought that I was adding the

in the proper spots along with the id, but that appears to be incorrect.

#2

id is an attribute where <div></div> is an element. The proper place for the attribute is inside the div element’s opentag.

<div id="introduction">

Note two things, one of which is important, and the other of which is convention;

  1. white space before attribute; always; and,
  2. double quotes on HTML attribute values.

#3

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