HTML basics
Computer Science · Web development
Question 1 of 10
0Which tag defines the title shown in the browser tab?
Stuck? Read the explanation
Unlocks at a streak of 5 correct answers in a row.
Embed this practice on your site or class page
Paste this HTML into your page. Students practise right there; it is free and needs no account.
HTML basics explained
HTML, which stands for HyperText Markup Language, describes the structure and content of a web page. It is a markup language rather than a programming language. It uses elements, written as tags in angle brackets, to mark up headings, paragraphs, images, links and lists.
Most elements have an opening tag and a closing tag, with the content between them. The closing tag has a forward slash, so starts a paragraph and ends it. Some elements, such as the image tag, do not need a closing tag. Elements can contain other elements, and the browser turns the page into a tree of nodes. Attributes add extra information inside the opening tag, such as href in a link or src in an image. Using elements with clear meaning, such as nav or main, is called semantic HTML and helps screen readers and search engines understand the page.
A common mistake is to forget a closing tag or to nest tags wrongly, such as text. Browsers try to correct errors, so the page may look fine but behave unpredictably.
Worked example
A small page might look like this:
<!DOCTYPE html>
<html>
<body>
<h1>My Hobbies</h1>
<p>I like <a href="https://example.com">chess</a>.</p>
</body>
</html>
- The h1 element creates a top-level heading.
- The p element creates a paragraph.
- Inside the paragraph, the a element creates a link. Its href attribute holds the web address the link goes to.
What you will practise
105 multiple-choice questions (Easy, Medium, Hard). Each answer is followed by an explanation.
Example questions
- HTML structures:
- A tag like <p> marks:
- Attributes:
- The <a> tag creates:
- Semantic HTML:
- Which attribute of the img element gives the location of the image file?
- Which tag defines the largest heading level?
- The <!DOCTYPE html> declaration at the top of a page tells the browser:
…and 97 more.