Summary

In the third lesson, we learned that:

  • Attributes are written in the opening tag in the form name="value", always with the value in quotes.
  • The id attribute identifies an element, so its value must be unique on the page. Every page should also have the lang attribute on the html element.
  • Links are created with the a element (anchor) and its href attribute, whose value is the address the link leads to.
  • A link with the target attribute set to _blank opens in a new tab.
  • Addresses can be absolute, e.g. https://www.wikipedia.org/, or relative, e.g. ./dog.html.
  • A relative address starting with ./ looks for the file in the same folder as the HTML file with the link.
  • A relative address starting with / looks for the file in the root folder of the project.
  • Images are added with the img element, which has no content and no closing tag. Its src attribute holds the address of the image and alt a description, which screen readers read out and browsers show when the image can't be loaded. A purely decorative image gets alt="".
  • Videos are added with the video element and its src attribute. The boolean attribute controls turns on the control buttons. The content of the element is shown only by browsers that can't play video.
  • An image (or another element) placed inside a link becomes a link too.
  • A link can lead to a part of the current page: the value of href is # followed by the id of the element. A link to just # leads to the top of the page.
  • The elements header, nav, main, section and footer say what each part of the page is, while div only groups elements together.

In this lesson, we learned how to add images and videos, how to use links and what attributes are, and we gave our page a meaningful structure. In the next lesson, we will learn how to create tables in HTML.

Instructions

Congratulations on completing the third lesson! The editor contains your final code from this lesson. Now you can customize the page with your new knowledge.

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

12/12