wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

CSS Rules Quiz-unit 4 CodeHS

Total questions: 7

Worksheet time: 4mins

Name
Class
Date
1.

Which of the following is a valid CSS rule?

a)

h1 {

color: blue;

}

b)

<h1> {

color: blue;

}

c)

h1 {

color="blue";

}

d)

h1 {

color=blue;

}

2.

CSS rules have a selector that defines which HTML elements the rule applies to. Which of the following ranks the selectors from highest precedence to lowest precedence?(most important to least important)

a)

Select by tag name, select by class name, select by id name

b)

Select by id name, select by tag name, select by class name

c)

Select by class name, select by id name, select by tag name

d)

Select by id name, select by class name, select by tag name

3.

Which of the following statements are true about styling your web pages with CSS?

I. Styling with CSS is more scalable than using style= on each HTML tag that you want to style

II. You can change HTML tag style attributes with CSS files that are also possible using inline style= on an HTML tag

a)

I only

b)

II only

c)

I and II

d)

Neither I nor II

4.

Which of the following code snippets will select all <img> tags on a page and give them a height of 200 pixels?

a)

<img style="height:200px;">

b)

tag="img" { height: 200px; }

c)

{ height: 200px; }

d)

img {

height: 200px;

}

5.

Suppose you have the following CSS rules:

p { color: green; }

.fire { color: red; }

#title { color: blue; }

What font color will the following HTML element have after being styled by the given CSS:

<h1 class="fire">Welcome!</h1>

a)

Red

b)

Green

c)

Blue

d)

Black

6.

Suppose you have the following CSS rules:

p { color: green; }

.fire { color: red; }

#title { color: blue; }

What font color will the following HTML element have after being styled by the given CSS:

<p class="title">My First Paragraph</p>

a)

red

b)

blue

c)

green

d)

black

7.

Suppose you have the following CSS rules:

p { color: green; }

.fire { color: red; }

#title { color: blue; }

What font color will the following HTML element have after being styled by the given CSS:

<p class="fire" id="title">Hello World!</p>

a)

red

b)

blue

c)

green

d)

black