Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

9 - REVIEW | HTML5 AND CSS

Total questions: 26

Worksheet time: 12mins

Name
Class
Date
1.

1. Correct the Image Tag Syntax

Question:
What is wrong with this image tag?

<img src="cat.jpg" alt="Cute cat" width="200px" height="200">

a)

a) The height attribute has no unit of measurement.

b)

b) The alt text should be wrapped in quotation marks.

c)

c) The src path should include https://.

d)

d) There's no issue with this image tag.

2.

Question:
What is the issue with the following CSS for the button?

button { border: 1px solid #000; box-shadow: 10px 10px; }

a)

a) Missing values for the box-shadow (horizontal, vertical, blur, and color).

b)

b) The box-shadow should use border as a value.

c)

c) The border property should be placed after box-shadow.

d)

d) The box-shadow syntax is correct.

3.

3. Fix the Anchor Tag

Question:
How should you fix this anchor tag?

<a href=https://www.example.com Visit Example</a>

a)

a) Add target="_blank" to open the link in a new tab.

b)

b) Add quotes around the href URL.

c)

c) Add the href attribute after the text.

d)

b) Add quotes around the href URL.

4.

4. Center Text Vertically and Horizontally

Question:
How can you center text both vertically and horizontally in a div using CSS?

.center { text-align: center; vertical-align: middle; }

a)

a) Use display: flex and justify-content: center.

b)

b) Use position: absolute and top: 50%.

c)

c) Use text-align: center and line-height: 100%.

d)

d) The current code is already correct.

5.

Question:
What is missing in this HTML list structure?

<ol> <li>Apples</li> <li>Bananas</li> </ol>

a)

a) There should be no <li> tags for each item.

b)

b) Add a third item to the list (e.g., "Oranges").

c)

d) There’s nothing missing in this list.

d)

d) The current code is already correct.

6.

What is the issue with the following CSS for the button?

button { border: 1px solid #000; box-shadow: 10px 10px; }

a)

a) Missing values for the box-shadow (horizontal, vertical, blur, and color).

b)

b) The box-shadow should use border as a value.

c)

c) The border property should be placed after box-shadow.

d)

d) The box-shadow syntax is correct.

7.

What is the error in this code that links an external stylesheet?

<head> <style src="styles.css"> </head>

a)

a) The <style> tag should not be used for linking external CSS.

b)

b) src is the wrong attribute; it should be href.

c)

c) The style tag must be inside the body section, not the head.

d)

d) There's no issue with this code.

8.

Question:
How can you correctly declare a font family in CSS?

h1 { font: Arial, Helvetica, sans-serif; }

a)

a) Use font-family instead of font.

b)

b) The font-family should be enclosed in quotes.

c)

c) The font values should be ordered in reverse.

d)

d) There’s nothing wrong with this declaration.

9.

Question:
What needs to be fixed in this input field?

<input type="text" value= "John">

a)

a) The value attribute should not have spaces.

b)

b) The value should be inside double quotes.

c)

c) The type should be password instead of text.

d)

d) There's nothing wrong with this code.

10.

Question:
What is missing in this padding rule?

div { padding: 10px 20px }

a)

a) There should be no padding values.

b)

b) The padding rule is missing a semicolon.

c)

c) Add padding on all sides, not just two.

d)

d) There's nothing wrong with this code.

11.

Fill in the blank to set the background to light blue for the body element:

body { background- (a)   : lightblue; }

12.

Fill in the blank to apply padding of 20px to all sides of the div element:

div { (a)   : 20px; }

13.

p { font- (a)   : 16px; }

14.

.box { border: (a)   2px solid black; }

15.

Fill in the blank to change the text color to red when hovering over a link:

a:hover { color: (a)   ; }

16.

Fill in the blank to align the text inside the h1 element to the center:

h1 { text-align: (a)   ; }

17.

Fill in the blank to set both the width and height of the .container class to 100%:

.container { width: ______; height: ______; }

(a)  

18.

Fill in the blank to add a 10px margin to the top of the p element:

p { margin- (a)   : 10px; }

19.

Fill in the blank to set the font of h2 to Arial, and use sans-serif as the fallback:

h2 { font-family: (a)   , sans-serif; }

20.

Fill in the blank to add a 1px solid red border to the input element:

input { border: (a)   1px solid red; }

21.

Label the parts of this CSS rule:
div {

color: blue;

font-size: 16px;

margin: 10px;

}

WHAT DO WE CALL TO THE PART OF color, font-size, margin?

(a)  

22.

Label the parts of this CSS rule:
div {

color: blue;

font-size: 16px;

margin: 10px;

}

WHAT DO WE CALL TO THE PART OF blue, 16px, 10px?

(a)  

23.

Label the parts of this CSS rule:
div {

color: blue;

font-size: 16px;

margin: 10px;

}

WHAT DO WE CALL TO THE PART OF div?

(a)  

24.

You are designing a personal portfolio website. You want to make sure the website looks good on both desktop and mobile devices. Which CSS method would you use to achieve this?

a)

Use media queries to adapt the layout for different screen sizes.

b)

CSS Gridb) Use fixed widths for all elements so they stay the same across all screen sizes.

c)

Float-based layoutc) Use inline styles to override the default styles for mobile.

d)
  • d) Use the float property to position elements for all screen sizes.

25.

You're working on an e-commerce site, and you need to create a section to showcase product images. Which CSS property would you use to make the images responsive, so they adjust to the container's size while maintaining their aspect ratio?

a)

object-fit: contain;

b)

width: 100%; height: auto;

c)

display: flex; align-items: center;

26.

You're creating a navigation bar that needs to be fixed at the top of the page while users scroll down. Which CSS property would you use to achieve this effect?

a)

position: fixed; top: 0;

b)

position: relative; top: 0;

c)

position: absolute; top: 50px;

d)
  • display: block; margin: 0 auto;