WorksheetsCSS Selector by ID
Total questions: 30
Worksheet time: 16mins
p {color: red;}
p {color: red;}
What does a class do?
adds color to words
adds style to specific elements
adds style to a whole page
adds a lot more work
Select the rule set to make all the text in your web page blue and centered.
p {
color: blue;
}
body {
text-align: left;
color: blue;
}
p {
text-align: center;
color: blue;
}
body {
text-align: center;
color: blue;
}
What is a class selector?
Selects any element within the HTML document that has a class attribute.
Allows you to select any element within the HTML document as long as it has an ID attribute
Allows you to select the descendant of elements within the document
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>
.redtext { color: red; }
#redtext { color: red; }
li > redtext { color: red; }
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>
>media { color: red; }
.media { color: red; }
#media { color: red; }
You can apply multiple CSS IDs to the multiple elements.
True
False
What does the ID selector do?
Apply the style to a group of elements
Apply the style to all the elements
Apply the style to a specific element
A selectors in CSS is basically used to select the element you want to style.
TRUE
FALSE
Declarations are split into two parts (a property and a value), and are separated by a comma.
TRUE
FALSE
The element selectors select the HTML elements by tag name.
TRUE
FALSE
The id selector is written with the period character (.), followed by the id of an element.
TRUE
FALSE
The class selector selects the element based on the class attribute.
TRUE
FALSE
1. What is the correct CSS syntax for making all the <p> elements italic?
p {font-weight:italic;}
p {font-style:italic;}
<p style="text-decoration:italic">
p {text-decoration:italic;}
Choose the correct CSS code to set the list style for unordered lists to “square”, and the list style for ordered lists to “upper-roman”.
ul {list-style-type: square;}
ol {list-style-type: upper-roman;}
ol {list-style-type: square;}
ul {list-style-type: upper-roman;}
ol {list-style-type: square;}
ol {list-style-type: upper-roman;}
ul {list-style-type: square;}
ul {list-style-type: upper-roman;}
Identify the CORRECT CSS syntax to set a background color.
{ body; color: blue }
body { color: blue }
body: color { blue }
{ body; color; blue }
Choose how does an ID selector is used to set the font size to be 12px.
para1 {font-size: 12px;}
#para1 { font-size: 12px;}
#para1 { font-size: 12px;}
#para1 { font-size: 12px; }
Based on the following script, discover the style rule that will be applied to the HTML element with class named as "center large".
p.center { text-align: center; }
p.large { font-size: 300%; }
All <center> and <large> elements will be center-aligned, with a large font size.
All HTML elements with class="center" and class="large" will be center-aligned, with a large font size.
All <p> elements with class="center large" will be center-aligned, with a large font size.
All <p = center> and <p = large> elements will be center-aligned, with a large font size.
Choose the codes on how do you set the border for the following paragraph to solid style with red color.
<html>
<body>
<p>Hello World!</p>
<p>These paragraphs are styled with CSS.</p>
</body>
</html>
p {
border-style: solid;
border-color: red;
}
p {
style: solid;
color: red;
}
p {
border: solid;
color: red;
}
p {
border: solid, red;
}
The function that CSS language is
to style a webpage
aesthetics an entire website
used to stylize elements written in a markup Language
all are correct
The difference between class and id attributes is...
the identifier is created using a dot (.) and the class use a # symbol.
a Class must be used just once whereas Id can be applied multiple times on the HTML.
a Class can be used by multiple HTML elements, while an Id must only be used by one HTML.
This must be a unique element used in HTML
The image represents an (external, inline, or internal) (a) style used in this created document.
This is the correct link to connect one HTML with a CSS page...
