In this lesson we take a look at some of the basic HTML elements and what they do.
HTML comes with 6 different heading tags <h1>
to <h6>
. The most important headings on a page use <h1>
, the second most important headings use <h2>
and so on.
Paragraphs are defined using the <p>
tag. Each paragraph will go onto a new line with some space above and below it.
Images are defined using the <img>
tag. For each <img>
tag we need to give some extra information for the location of the image file to show and the width and height. These are called attributes and they go inside the <img>
tag.
src
- this is the source or location of the image file to display.width
- we can say how wide the image should appear (in pixels or a percentage).height
- we can say how high the image should appear (in pixels or a percentage).Links are used to 'link' to other web pages and they are defined using the <a>
(anchor) tag. For each <a>
tag we need to give some extra information for the location of where to link to as well whether to open a new tab or not. These are called attributes and they go inside the opening <a>
tag.
href
- this is the location of the web page we want to link to.target
- this says whether we open the link in the current tab or a new tab.Whatever we put inside the <a></a>
tags is what the browser will display as the link.