NEW
Font size
WorksheetsQ3 - WebDez_CertPrep
Total questions: 25
Worksheet time: 15mins
How do you select an element with the ID "main-header" in CSS?
.main-header {}
#main-header {}
main-header {}
<main-header> {}
What symbol is used to target an ID in CSS?
. (dot)
# (hashtag)
@ (at symbol)
* (asterisk)
Which of the following is true about ID selectors in CSS?
An ID can be used for multiple elements in an HTML document.
An ID should be unique within an HTML document.
An ID is the same as a class.
IDs must start with a number.
Why would you use an ID selector instead of a class selector?
When you want to style multiple elements the same way.
When you need to apply a unique style to only one specific element.
When you want to apply styles globally.
There is no difference between IDs and classes.
What is wrong with following CSS rule?
#1header { color: blue; }
The ID name should be written in quotes.
IDs cannot start with a number.
The # symbol is incorrect for an ID selector.
The property color is not valid for an ID selector.
How do you assign an ID to an HTML element?
<p class="header">Hello</p>
<p id="header">Hello</p>
<p #header>Hello</p>
<p .header>Hello</p>
Which of these selects ALL page elements?
# (hastag)
. (dot)
* (asterisk)
& (ampersand)
Which of these requires <div> to be an immediate child of another <div>?
div > div
div, div
div div
div ~ div
Which of these would select only images where class="logo"?
.logo
img.logo
#logo
img logo
img > logo
Which CSS selector selects all of the highlighted tags?
a
div.a
a, ul
#a
a.href
Which CSS selector selects only the highlighted item?
a
div a
li a
ul > a
Which is the correct syntax for making a CSS block for an ID called fancy?
#fancy {
}
.fancy {
}
id fancy {
}
id#fancy{
}
Which is the correct syntax for making a CSS block for a CLASS called someclass?
.someclass {
}
#someclass {
}
class someclass{
}
class.someclass{
}
Identify the CSS Selector Below
h1 {......}
ID Selector
Class Selector
Element Selector
Grouping Selector
Identify the CSS Selector Below
p.crown {......}
Element AND Class Selector
Descendant Selector
Element Selector
Grouping Selector
Identify the CSS Selector Below
.crown {......}
ID Selector
Class Selector
Element Selector
Grouping Selector
Identify the CSS Selector Below
#crown {......}
ID Selector
Class Selector
Element Selector
Grouping Selector
Which is an example of an CSS Descendant Selector?
table
h1, h2
p .title
p.title
Which of the following is an example of a pseudo-class selector?
a:hover
#hover
.hover
hover
What is the purpose of using descendant selectors in CSS?
To apply styles to elements based on their ID
To apply styles to elements based on their class
To apply styles to elements that are nested within other elements
To apply styles to elements based on their tag
Given the following CSS code, what will be the background color of the <div> element?
```div { background-color: red; } div:hover { background-color: blue; } ```
Red
Blue
Red when hovered, Blue otherwise
Blue when hovered, Red otherwise
Which symbol is used to indicate a CSS class selector?
. (a period)
# (a hashtag)
; (a semicolon)
: (a colon)
Which symbol is used to indicate a CSS id selector?
. (a period)
# (a hashtag)
; (a semicolon)
: (a colon)
Suppose there is a CSS class called fancy that exists.
Which of the following bits of HTML code correctly uses the fancy class?
<p .fancy>I'm fancy!</p>
<p class fancy>I'm fancy!</p>
<p class="fancy">I'm fancy</p>
<p .fancy class>I'm fancy</p>
Which of the following is NOT a valid class name?
1classname
class_name
class-name
classname2
