wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Q3 - WebDez_CertPrep

Total questions: 25

Worksheet time: 15mins

Name
Class
Date
1.

How do you select an element with the ID "main-header" in CSS?

a)

.main-header {}

b)

#main-header {}

c)

main-header {}

d)

<main-header> {}

2.

What symbol is used to target an ID in CSS?

a)

. (dot)

b)

# (hashtag)

c)

@ (at symbol)

d)

* (asterisk)

3.

Which of the following is true about ID selectors in CSS?

a)

An ID can be used for multiple elements in an HTML document.

b)

An ID should be unique within an HTML document.

c)

An ID is the same as a class.

d)

IDs must start with a number.

4.

Why would you use an ID selector instead of a class selector?

a)

When you want to style multiple elements the same way.

b)

When you need to apply a unique style to only one specific element.

c)

When you want to apply styles globally.

d)

There is no difference between IDs and classes.

5.

What is wrong with following CSS rule?

#1header { color: blue; }

a)

The ID name should be written in quotes.

b)

IDs cannot start with a number.

c)

The # symbol is incorrect for an ID selector.

d)

The property color is not valid for an ID selector.

6.

How do you assign an ID to an HTML element?

a)

<p class="header">Hello</p>

b)

<p id="header">Hello</p>

c)

<p #header>Hello</p>

d)

<p .header>Hello</p>

7.

Which of these selects ALL page elements?

a)

# (hastag)

b)

. (dot)

c)

  • * (asterisk)

d)

& (ampersand)

8.

Which of these requires <div> to be an immediate child of another <div>?

a)

div > div

b)

div, div

c)

div div

d)

div ~ div

9.

Which of these would select only images where class="logo"?

a)

.logo

b)

img.logo

c)

#logo

d)

img logo

e)

img > logo

10.

Which CSS selector selects all of the highlighted tags?

a)

a

b)

div.a

c)

a, ul

d)

#a

e)

a.href

11.

Which CSS selector selects only the highlighted item?

a)

a

b)

div a

c)

li a

d)

ul > a

12.

Which is the correct syntax for making a CSS block for an ID called fancy?

a)

#fancy {

}

b)

.fancy {

}

c)

id fancy {

}

d)

id#fancy{

}

13.

Which is the correct syntax for making a CSS block for a CLASS called someclass?

a)

.someclass {

}

b)

#someclass {

}

c)

class someclass{

}

d)

class.someclass{

}

14.

Identify the CSS Selector Below

h1 {......}

a)

ID Selector

b)

Class Selector

c)

Element Selector

d)

Grouping Selector

15.

Identify the CSS Selector Below

p.crown {......}

a)

Element AND Class Selector

b)

Descendant Selector

c)

Element Selector

d)

Grouping Selector

16.

Identify the CSS Selector Below

.crown {......}

a)

ID Selector

b)

Class Selector

c)

Element Selector

d)

Grouping Selector

17.

Identify the CSS Selector Below

#crown {......}

a)

ID Selector

b)

Class Selector

c)

Element Selector

d)

Grouping Selector

18.

Which is an example of an CSS Descendant Selector?

a)

table

b)

h1, h2

c)

p .title

d)

p.title

19.

Which of the following is an example of a pseudo-class selector?

a)

a:hover

b)

#hover

c)

.hover

d)

hover

20.

What is the purpose of using descendant selectors in CSS?

a)

To apply styles to elements based on their ID

b)

To apply styles to elements based on their class

c)

To apply styles to elements that are nested within other elements

d)

To apply styles to elements based on their tag

21.

Given the following CSS code, what will be the background color of the <div> element?

```div { background-color: red; } div:hover { background-color: blue; } ```

a)

Red

b)

Blue

c)

Red when hovered, Blue otherwise

d)

Blue when hovered, Red otherwise

22.

Which symbol is used to indicate a CSS class selector?

a)

. (a period)

b)

# (a hashtag)

c)

; (a semicolon)

d)

: (a colon)

23.

Which symbol is used to indicate a CSS id selector?

a)

. (a period)

b)

# (a hashtag)

c)

; (a semicolon)

d)

: (a colon)

24.

Suppose there is a CSS class called fancy that exists.

Which of the following bits of HTML code correctly uses the fancy class?

a)

<p .fancy>I'm fancy!</p>

b)

<p class fancy>I'm fancy!</p>

c)

<p class="fancy">I'm fancy</p>

d)

<p .fancy class>I'm fancy</p>

25.

Which of the following is NOT a valid class name?

a)

1classname

b)

class_name

c)

class-name

d)

classname2