0

Computer

Quick Revision

Chapter 2: HTML

Key Concepts

  • 1What are the mandatory tags in a basic HTML5 document structure?
  • 2What is the difference between <ol> and <ul> in HTML? Which tags do they use for items?
  • 3Name the HTML tags used for creating a table and describe each one.

Important Formulas & Facts

#1

<!DOCTYPE html> — declares HTML5 version. <html> — root element. <head> — contains metadata, title, links. <title> — sets the page/tab title. <body> — contains all visible content. Every valid HTML5 page must have all of these.

#2

<ol> (Ordered List) displays items with sequential numbers or letters — use when order matters. <ul> (Unordered List) displays items with bullet points — use when order does not matter. Both use <li> (List Item) tags for each item inside them.

#3

<table> — defines the entire table. <tr> (Table Row) — defines a horizontal row. <th> (Table Header) — bold, centred header cell. <td> (Table Data) — standard data cell. colspan merges cells horizontally; rowspan merges cells vertically.

Must-Know Questions

Q1Which HTML tag is used to create a hyperlink?
Explanation

The <a> (anchor) tag is used to create hyperlinks in HTML. The href attribute specifies the destination URL. Example: <a href='https://www.example.com'>Click Here</a>

Q2Which attribute is used in the <img> tag to provide alternative text for an image?
Explanation

The 'alt' attribute in the <img> tag provides alternative text for an image. This text is displayed when the image cannot be loaded and is also used by screen readers for accessibility. Example: <img src='photo.jpg' alt='A beautiful sunset'>

Q3Write the HTML code to create an ordered list with three items: Apple, Banana, and Cherry.
Explanation

An ordered list uses the <ol> tag, and each list item uses the <li> tag. The code is: <ol><li>Apple</li><li>Banana</li><li>Cherry</li></ol>. An ordered list displays items with numbers by default.

Q4What is the purpose of the 'colspan' attribute in an HTML table?
Explanation

The 'colspan' attribute allows a table cell to span across multiple columns. For example, <td colspan='3'> will make that cell occupy the space of 3 columns. Similarly, 'rowspan' makes a cell span multiple rows.

Q5Explain the basic structure of an HTML document with appropriate tags.
Explanation

A basic HTML document has: <!DOCTYPE html> declaration, <html> root element, <head> section (contains <title>, metadata, linked stylesheets), and <body> section (contains all visible content). The <title> tag sets the browser tab title. Everything visible to the user goes inside <body>. Example: <!DOCTYPE html><html><head><title>My Page</title></head><body><h1>Hello</h1><p>Welcome!</p></body></html>

Practice HTML

Reinforce what you just revised with practice questions