wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Q4 Exam 1 (8.10, 8.11, 8.12)

Total questions: 20

Worksheet time: 15mins

Name
Class
Date
1.

What does CSS stand for?

a)

Creative Style Sheets

b)

Cascading Style Sheets

c)

Computerized Style Structure

d)

Colorful Site Styles

2.

Which of the following is the correct way to apply an external CSS file to an HTML document?

a)

<css> styles.css</css>

b)

<link rel= "stylesheet" href="styles.css">

c)

<style>styles.css<style>

d)

<script src="styles.css"></script>

3.

How do you select all <h1> elements in a CSS file?

a)

#h1 { color: blue; }

b)

.h1 { color: blue; }

c)

h1 { color: blue; }

d)

<h1> { color: blue; }

4.

What is the correct way to apply a CSS rule to an HTML class named "highlight" ?

a)

#highlight { color: yellow; }

b)

.highlight { color: yellow; }

c)

<highlight> { color: yellow; }

d)
  • highlight { color: yellow; }

5.

Which CSS property is used to change the background color of an element?

a)

color

b)

text-color

c)

background-color

d)
  • bgcolor

6.

What is the default position of an HTML element?

a)

relative

b)

absolute

c)

static

d)

fixed

7.

What symbol is used to select an ID in CSS?

a)

. (dot)

b)

# (hashtag)

c)

* (asterisk)

d)

@ (at symbol)

8.

Which of the following CSS rules correctly applies a font size of 16px to all <p> elements?

a)

p { font-size: 16px; }

b)

.p { font-size: 16px; }

c)

<p> { font-size: 16px; }

d)

#p { font-size: 16px; }

9.

What is the difference between an ID selector and a class selector?

a)

IDs can be used for multiple elements, while classes apply to only one element.

b)

IDs are used only in JavaScript, while classes are used in CSS.

c)

Classes can be used for multiple elements, while IDs should be unique.

d)

There is no difference; they are interchangeable.

10.

Which of the following is the correct way to apply multiple CSS classes to a single HTML element?

a)

<p class="class1, class2">

b)

<p class="class1 class2">

c)

<p class="class1; class2">

d)

<p class="class1.class2">

11.

What does the text-align property do?

a)

Changes the font of the text

b)

Moves the text to the left, center, or right

c)

Changes the size of the text

d)

Makes the text bold

12.

The space inside an element’s border is controlled by which CSS property?

a)

padding

b)

margin

c)

border-width

d)

spacing

13.

Which CSS rule will apply a blue text color to elements with the class "title"?

a)

#title { color: blue; }

b)

title { color: blue; }

c)

.title { color: blue; }

d)

<title> { color: blue; }

14.

How do you write a CSS comment?

a)

// This is a comment

b)

/* This is a comment */

c)

<!-- This is a comment -->

d)

" This is a comment "

15.

Which of the following correctly sets the background color of all <div> elements to red?

a)

.div { background-color: red; }

b)

<div> { background-color: red; }

c)

#div { background-color: red; }

d)

div { background-color: red; }

16.

Which of the following statements is true about CSS classes?

a)

You can use the same class name on multiple elements.

b)

A class name must always start with a number.

c)

Class names must be written in all uppercase letters.

d)
  • A class name can only be used once per HTML document.

17.

How do you apply an ID selector named "main-heading" to an <h1> element in CSS?

a)

h1.main-heading {}

b)

h1#main-heading {}

c)

#main-heading {}

d)

id=main-heading {}

18.

What is the correct way to change the font style of a <p> tag to italic?

a)

p { text-style: italic; }

b)

p { font-style: italic; }

c)

p { style: italic; }

d)

p { italic: true; }

19.

Which CSS property controls the space outside an element’s border?

a)

padding

b)

margin

c)

border-spacing

d)

outline

20.

What will the following CSS rule do?

.button {

background-color: blue;

color: #222;

}

a)

It makes the background color of all buttons blue with white text.

b)

It makes the background color of any element with the class "button" blue with white text.

c)

It makes only <button> elements blue with white text.

d)

It will not apply to any elements because "button" is a reserved keyword.