NEW
Font size
WorksheetsCSS- Styling Websites
Total questions: 20
Worksheet time: 10mins
CSS stands for _____________________
Cascading Style Sheets
Cascading Style Samples
Changing Style Sheets
Changing Slide Shows
CSS is the language for ____________
creating and styling web pages
searching the internet
designing web pages and adding style
creating colorful web pages
Why do we use CSS?
HTML wasn’t intended to be able to style web pages, CSS allows us to add style
Separate the content of a web page from the design of a web page
Easily modify the look and feel of a web site even at a large scale
All of the above
Which of the following is a valid CSS rule?
h1 {
color: blue;
}
style="color:blue;"
css="color:blue;"
h1 {
color {
blue;
}
}
Which of the following code snippets will select all <img> tags on a page and give them a height of 200 pixels?
<img style="height:200px;">
tag="img" {
height: 200px;
}
img {
height: 200px;
}
<img> {
height: 200px;
}
A selector defines __________
which HTML elements a CSS rule applies to.
which URL elements an HTML applies to.
which CSS elements apply to HTML
which CSS elements apply to CodeHS
Which of the following code snippets will select all HTML elements with the class “alert” and set their color to be red?
alert {
color: red;
}
.alert {
color: red;
}
#alert {
color: red;
}
class="alert" {
color: red;
}
_____________ is an attribute we can add to HTML tags in order to style a specific group of elements.
Style
Identity
Class
Worth
Which of the following CSS rules will select the HTML element with the id logo and set the font size for that element to 60 pixels?
logo {
font-size: 60px;
}
.logo {
font-size: 60px;
}
#logo {
font-size: 60px;
}
id="logo" {
font-size: 60px;
}
____________ is an attribute we can add to an HTML tag to style that specific element.
ID
AD
BC
HI
What is the function of the Cascade in CSS?
The Cascade is a set of guidelines to make your site look beautiful.
The Cascade helps you write styling for your websites quickly by providing easy templates to use.
The Cascade determines which CSS rules will be applied when multiple rules for an item are contradictory.
The Cascade will make sure there are no typos in your CSS rules.
True or False: In the case that two conflicting rules have the same order and specificity, the rule that is written first will be applied.
True
False
In what order does the Cascade look at factors to determine which CSS rule to follow?
Order, Importance, Specificity
Importance, Order, Specificity
Specificity, Importance, Order
Importance, Specificity, Order
Which of the following is a valid CSS rule?
h1 {
color: blue;
}
<h1> {
color: blue;
}
h1 {
color="blue";
}
h1 {
color=blue;
}
CSS rules have a selector that defines which HTML elements the rule applies to.
We’ve learned about the following CSS Selectors:
- Select by tag name
- Select by class name
- Select by id name
Which of the following ranks the selectors from highest precedence to lowest precedence?
Select by tag name, select by class name, select by id name
Select by id name, select by tag name, select by class name
Select by id name, select by class name, select by tag name
Select by class name, select by id name, select by tag name
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 create styles with CSS that are not possible using style= on an HTML tag
I only
II only
I and II
Neither I nor II
Suppose you have written a web page using HTML and CSS and it is hosted at the URL yourdomain.com/home.html
Which of the following statements is true about which devices can view your website?
Only browsers on desktop computers can view your website because only desktop browsers can render HTML based web pages.
Only browsers on mobile phones can view your website because only mobile browsers can render HTML based web pages.
Only computers made after the day you publish your website can view your website. Older computers can’t understand HTML and CSS.
Any browser on any device will be able to view your webpage, because all browsers and devices on the Internet agree to use the same protocols for sending, receiving, and viewing webpages.
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>
red
green
blue
black
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>
red
green
blue
black
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>
red
green
blue
black
