HTML & CSS Exercise Solutions
A. Tick (✓) the correct option
• 1. b. HTML (✓)
• 2. b. forward slash (/) (✓)
• 3. b. src (✓)
• 4. b. The web browser's title bar (✓)
• 5. b. HyperText Markup Language (✓)
• 6. c. External stylesheet (✓)
B. Fill in the blanks
• 1. text editor
• 2. HTML
• 3. tags
• 4. attributes
• 5. web browser
C. Match the following
• 1. <p> → Paragraph tag
• 2. alt → Alternative text for an image
• 3. <img> → Image tag
• 4. <h1> → Largest heading tag
D. One-sentence answers
• 1. The <head> section contains metadata and information about the document.
• 2. An opening tag starts an element, while a closing tag ends it with a '/'.
• 3. The alt attribute provides alternative text for an image.
• 4. The <h1> tag defines the largest heading.
• 5. An internal stylesheet is placed within the <head> section.
• 6. CSS stands for Cascading Style Sheets.
E. Short answers
1. Difference between HTML and CSS:
- HTML defines the structure and content of a webpage.
- CSS defines the style and presentation (colors, fonts, layout).
2. Basic structure of an HTML document:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Heading</h1>
<p>Paragraph</p>
</body>
</html>
3. Three common HTML formatting tags:
- <b> (bold)
- <i> (italic)
- <u> (underline)
4. Purpose of attributes:
Attributes provide extra details about HTML elements, e.g., src, alt, background color.
5. Three ways to include CSS in HTML:
- Inline CSS (inside style="")
- Internal CSS (inside <style> tag in <head>)
- External CSS (linked via <link> file)
6. Change background color using CSS:
body {
background-color: lightblue;
}