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
idattribute identifies an element, so its value must be unique on the page. Every page should also have thelangattribute on thehtmlelement. - Links are created with the
aelement (anchor) and itshrefattribute, whose value is the address the link leads to. - A link with the
targetattribute set to_blankopens 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
imgelement, which has no content and no closing tag. Itssrcattribute holds the address of the image andalta description, which screen readers read out and browsers show when the image can't be loaded. A purely decorative image getsalt="". - Videos are added with the
videoelement and itssrcattribute. The boolean attributecontrolsturns 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
hrefis#followed by theidof the element. A link to just#leads to the top of the page. - The elements
header,nav,main,sectionandfootersay what each part of the page is, whiledivonly 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
12/12