oldoc63 / learningHTML

Learning HTML with Codecademy and GitHub
0 stars 0 forks source link

Header and Nav #64

Closed oldoc63 closed 2 years ago

oldoc63 commented 3 years ago

A <header> is a container usually for either navigational links or introductory content containing <h1> to <h6> headings.

<header>
  <h1>
     Everything you need to know about pizza!
  </h1>
</header>
oldoc63 commented 3 years ago

This can be compared to the code below which uses a <div> tag instead of a <header> tag:

<div id="header">
  <h1>
    Everything you need to know about pizza!
  </h1>
</div>
oldoc63 commented 3 years ago

By using a <header> tag, our code becomes easier to read. It is much easier to identify what is inside of the <h1>‘s parent tags, as opposed to a <div> tag which would provide no details as to what was inside of the tag.

oldoc63 commented 3 years ago

A <nav> is used to define a block of navigation links such as menus and tables of contents. It is important to note that <nav> can be used inside of the <header> element but can also be used on its own.

oldoc63 commented 3 years ago

Change <div> to <header> and <nav> respectively.