wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

CSS ID vs. Class

Total questions: 15

Worksheet time: 3mins

Name
Class
Date
1.
If you want to have more than one property for a CSS selector, what character separates them?
a)
comma (,)
b)
semi-colon (;)
c)
colon (:)
d)
dash (-)
2.
Which is correct CSS syntax? 
a)
{ body; color=black;}
b)
body: color= black
c)
body {color:black;}
d)
(body color is black) 
3.
Select the code below that uses CSS to configure a background color of #000000 for a web page.
a)
body { background-color: #000000; }
b)
body { bgcolor: #000000; }
c)
document { background­-page: #000000; }
d)
None of these
4.
What symbols go around the properties for each CSS selector?
a)
< >
b)
[ ]
c)
{ }
d)
( )
5.
Which is the value in this CSS?
p {color: red;}
a)
p
b)
color
c)
red
6.
Which is the selector for a link?
a)
a { }
b)
link { }
c)
href { }
d)
a href { }
7.
Which CSS code centers text?
a)
p {align: center;}
b)
p {text-align: center;}
c)
p {align=center;}
d)
p {center;}
8.
Which is the selector in this CSS?
p {color: red;}
a)
p
b)
color
c)
red
9.

What does a class do?

a)

adds color to words

b)

adds style to specific elements

c)

adds style to a whole page

d)

adds a lot more work

10.

Select the rule set to make all the text in your web page blue and centered.

a)

p {

color: blue;

}

b)

body {

text-align: left;

color: blue;

}

c)

p {

text-align: center;

color: blue;

}

d)

body {

text-align: center;

color: blue;

}

11.

What is a class selector?

a)

Selects any element within the HTML document that has a class attribute.

b)

Allows you to select any element within the HTML document as long as it has an ID attribute

c)

Allows you to select the descendant of elements within the document

12.

Which is the correct (and most specific) CSS selector statement to change the text color of the first <li> element to red in the following example:


<ul>

<li class="redtext">Gravy</li>

<li>Turkey</li>

<li>Potato</li>

</ul>

a)

.redtext { color: red; }

b)

#redtext { color: red; }

c)

li > redtext { color: red; }

13.

Which is the correct (and most specific) CSS selector statement to select the text inside the HTML element and change the text color to red in the following example:

<div id="media">

Lorem Ipsum Dolores.

</div>

a)

>media { color: red; }

b)

.media { color: red; }

c)

#media { color: red; }

14.

You can apply multiple CSS IDs to the multiple elements.

a)

True

b)

False

15.

What does the ID selector do?

a)

Apply the style to a group of elements

b)

Apply the style to all the elements

c)

Apply the style to a specific element