wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

HTML and CSS Review

Total questions: 20

Worksheet time: 20mins

Name
Class
Date
1.

Which tag is the most appropriate for an independent, self-contained piece of content like a blog post or a news article?

a)

<div>

b)

<section>

c)

<article>

d)

<aside>

2.

When creating a link that opens in a new tab (target="_blank"), which attribute is vital for security and performance?

a)

alt="new"

b)

title="external"

c)

rel="noopener"

d)

type="external"

3.

What is the primary purpose of the <label> tag's for attribute?

a)

To style the text differently.

b)

To programmatically link the label to a specific input id.

c)
  • To provide a tooltip for the user.

d)

To indicate the language of the form.

4.

Which HTTP method should be used in a <form> when sending sensitive data like a password?

a)

GET

b)

POST

c)

PUT

d)

SEND

5.

Which of the following is a "void element" (self-closing and has no closing tag)?

a)

<a>

b)

<p>

c)

<img>

d)

<form>

6.

Which tag should be used to define a thematic grouping of content, typically with a heading?

a)

<span>

b)

<section>

c)

<article>

d)

main>

7.

What does the <meta name="viewport" content="width=device-width"> tag achieve?

a)

It makes the website faster.

b)

It ensures the site renders correctly on mobile devices.

c)

It defines the height of the browser window.

d)

It is used for SEO keywords.

8.

Why is using <br> multiple times to create vertical spacing considered bad practice?

a)

It breaks the HTML structure.

b)

Browsers ignore more than one <br>.

c)

Spacing should be handled by CSS margins/padding for better control.

d)

It prevents the page from loading.

9.

Which list tag is best suited for a "Glossary" or "Dictionary" style layout?

a)

<ul>

b)

<ol>

c)

<dl>

d)

<li>

10.

What is the "root" element of every HTML document?

a)

<!DOCTYPE html>

b)

<html>

c)

<head>

d)

<body>

11.

If you set box-sizing: border-box;, what happens when you add padding to an element?

a)

The element gets wider.

b)

The padding is included within the defined width.

c)

he padding is added outside the border.

d)

The border disappears.

12.

Which selector has the highest specificity (will "win" over the others if applied)?

a)

p { color: red; }

b)

.text { color: blue; }

c)

#title { color: green; }

d)

body p { color: yellow; }

13.

Which unit is relative to the font size of the root element (usually <html>)?

a)

px

b)

%

c)

em

d)

rem

14.

What is the main difference between display: inline and display: inline-block?

a)

inline allows for a background color.

b)

inline-block allows you to set a width and height.

c)

inline starts on a new line.

d)

There is no difference.

15.

Why does position: sticky; might fail to work on a sidebar?

a)

The sidebar is too tall.

b)

A parent element has overflow: hidden; or overflow: auto;.

c)

he browser doesn't support it.

d)

It only works with images.

16.

How do you horizontally center a block-level element with a fixed width?

a)

text-align: center;

b)

float: center;

c)

margin: 0 auto;

d)

padding: 50%;

17.

Which property hides an element but still allows it to take up space in the layout?

a)

display: none;

b)

visibility: hidden;

c)

opacity: 1;

d)

osition: absolute;

18.

In Flexbox, which property controls an item's ability to grow if there is extra space?

a)

flex-basis

b)

flex-shrink

c)

flex-grow

d)

justify-content

19.

Why does a child with z-index: 999 might appear behind a sibling with z-index: 1?

a)

z-index only goes up to 100.

b)

The child element is not a <div>.

c)

The elements belong to different stacking contexts.

d)

z-index requires the float property.

20.

Can the CSS display property be animated using CSS Transitions?

a)

Yes, easily.

b)

Yes, but only with display: block.

c)

No, it is a binary switch and cannot be interpolated.

d)

Only if you use JavaScript.