Quizz
The full text of this chapter, to read or revisit. To practise, do the exercises.
▶ Do the exercisesExercise 1 — Correct HTML Document Structure
Which of the following represents the correct basic structure of an HTML document?
Hint : Consider the required elements and their correct nesting order in an HTML document.
Exercise 2 — Complete the HTML Document
Complete the HTML document structure with the appropriate tags:
Hint : Think about the required structure of an HTML document and the proper nesting of tags.
Exercise 3 — Correct Heading Hierarchy
Which of the following represents the correct hierarchical structure for headings?
Hint : Consider the proper use of heading levels for creating a hierarchical structure in your document.
Exercise 4 — HTML Elements and Their Purpose
Match each HTML element with its correct purpose:
<p><div><span><ul>Exercise 5 — Correct List Structure
Which of the following is the correct way to create an ordered list?
Hint : Consider what makes a list ordered and which elements are required to create a proper list structure.
Exercise 6 — Complete the List Structure
Complete the HTML code to create a list (unorderer) of Codémon types:
Hint : Think about how to properly structure an unordered list with list items.
Exercise 7 — Block vs. Inline Elements
Which of the following is NOT a block-level element?
<span><div><h1><p>Hint : Consider the difference between block elements (which start on a new line) and inline elements (which flow within text).
Exercise 8 — CSS Application Methods
Match each CSS application method with its correct example:
<p style="color: red;">Text</p><head>
<style>
p { color: red; }
</style>
</head><head>
<link rel="stylesheet" href="styles.css">
</head>selector { property: value; }Exercise 9 — CSS Color Values
Which of the following is NOT a valid way to specify the color red in CSS?
color: rgb(255, 0, 0);color: #FF0000;color: red;color: Red();Hint : Consider the different valid ways to specify colors in CSS (named colors, hex values, RGB functions, HSV functions, etc.).
Exercise 10 — Complete the CSS Color Properties
Complete the CSS code to set : - h1 text color to blue - h1 background color to yellow - p text color to green - p background color to light gray
Hint : Consider which CSS properties control text color and background color.
Exercise 11 — Border Shorthand Property
Which of the following is the correct order for the border shorthand property?
width, style, colorstyle, width, colorcolor, width, stylewidth, color, styleHint : Consider the standard order for the border shorthand property.
Exercise 12 — Complete the Border Properties
Complete the CSS code to create : - A blue border of 2px around a div - Rounded corners of 10px for the div - A red dashed bottom border of 3px around a paragraph - Rounded corners of 50% for the paragraph
Hint : Consider which properties control borders and rounded corners.
Exercise 13 — Border Properties and Their Effects
Match each border property with its effect:
border-widthborder-styleborder-colorborder-radiusExercise 14 — Margin vs. Padding
What is the main difference between margin and padding in CSS?
Hint : Think about where each property creates space relative to an element's border.
Exercise 15 — Complete the Spacing Properties
Complete the CSS code to add: - 20px padding inside a div - 10px margin outside the div - 15px margin on top of a paragraph - 5px padding on the left the paragraph
Hint : Consider which properties control spacing inside and outside elements, and how to target specific sides.
Exercise 16 — CSS Box Model Components
Match each box model component with its description:
marginborderpaddingcontentExercise 17 — CSS Margin Shorthand
In the CSS shorthand margin: 10px 20px 15px 5px;, which side has a margin of 5px?
Hint : Think about the order of values in the margin shorthand property. Tick-Tack..
Exercise 18 — Understanding CSS Shorthand Values
What will this CSS shorthand code do?
.codemon-card {
margin: 10px 20px;
}Hint : Think about how CSS applies values when there are only two values in a shorthand property.
Exercise 19 — Creating a Circle with CSS
Which CSS will create a perfect circle from a square <div> element?
border-radius: 50%;border-radius: 100px;border-radius: 100%;border-circle: true;Hint : Consider how border-radius values work with percentages versus fixed pixels.
Exercise 20 — CSS Properties and Values
Match each CSS property with a valid value for it:
colorborder-stylemarginborder-radius#ff5500dashed10px 5px50%Exercise 21 — Codémon Leaderboard Margins
You're styling a div and want specific spacing. What will this CSS do?
margin: 15px 5px 25px;Hint : Think about how CSS shorthand for margin works.
Exercise 22 — Codémon Arena Spacing
You're designing a Codémon battle arena with this CSS. What spacing will it have?
.battle-arena {
padding: 30px 10px 5px;
}Hint : Think about shorthand CSS syntax for padding and margin.
Exercise 23 — Total Element Width Calculation
If an element has width: 300px, padding: 10px on all sides, border: 5px on all sides, and margin: 15px on all sides, what is its total width including margin?
Hint : Calculate the total width by adding everything, it's simple math.
Exercise 24 — Spot the CSS Error
Which line in this CSS code is incomplete?
/* Codémon card styling */
.card {
width: 200px;
padding: 15px;
border: 2px solid blue;
margin: 20px 10px 5px 10px
background-color: lightblue;
border-radius: 10px;
}margin: 20px 10px 5px 10pxborder: 2px solid blue;padding: 15px;background-color: lightblue;Hint : Look carefully at each line. Check for missing punctuation or incorrect property order.
Exercise 25 — Proper HTML Nesting
Which of the following demonstrates correct HTML element nesting?
<p>This is a <strong>bold</strong> statement.</p><p>This is a <strong>bold statement.</p>
</strong><p>This is a bold</strong> statement.</p><strong>
<p>This is a bold statement.</strong>
</p>Hint : Consider the proper nesting of HTML elements and how tags should be closed in the reverse order they were opened.