wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Introduction to Web Technology and CSS

Total questions: 60

Worksheet time: 31mins

Name
Class
Date
1.

Which of the following is NOT a way to add CSS to a web page?

a)

Inline CSS

b)

Internal CSS

c)

External CSS

d)

Embedded JavaScript

2.

What is the term for CSS that is written directly inside an HTML element?

a)

Inline CSS

b)

Internal CSS

c)

External CSS

d)

Browser default

3.

When multiple style sheets are used in a web page, which value will be applied?

a)

The value from the first style sheet

b)

The value from the last read style sheet

c)

The value from the browser default

d)

The value from the internal style sheet only

4.

Arrange the following style sources in order of priority, from highest to lowest: Inline style, External/Internal style sheets, Browser default.

a)

Inline style > External/Internal style sheets > Browser default

b)

Browser default > Inline style > External/Internal style sheets

c)

External/Internal style sheets > Inline style > Browser default

d)

Browser default > External/Internal style sheets > Inline style

5.

Which statement best describes the concept of 'cascading' in CSS?

a)

All styles are ignored except the browser default.

b)

Styles from different sources combine into a new virtual style sheet, following a set priority.

c)

Only external style sheets are used for final styling.

d)

Internal style sheets override all other styles.

6.

Which type of CSS is typically placed in the head section of an HTML document?

a)

Inline CSS

b)

Internal CSS

c)

External CSS

d)

Browser default

7.

If a web page has conflicting styles from an inline style, an external style sheet, and the browser default, which style will be applied?

a)

Browser default

b)

External style sheet

c)

Inline style

d)

Internal style sheet

8.

Which part of a CSS rule specifies which HTML elements will be styled?

a)

Selector

b)

Declaration

c)

Property

d)

Value

9.

In the CSS rule h1 { color: blue; font-size: 12px; }, what is the value for the property 'font-size'?

a)

12px

b)

blue

c)

h1

d)

font-size

10.

What does the CSS selector 'p' target in an HTML document?

a)

All paragraph elements

b)

All list items

c)

All headings

d)

All elements with class 'p'

11.

How can you target both paragraphs and list items in a single CSS rule?

a)

By separating selectors with a comma

b)

By using a period before each selector

c)

By writing the selectors in separate rules

d)

By using a semicolon between selectors

12.

Which symbol is used in CSS to select elements by their class name?

a)

A period (.)

b)

A comma (,)

c)

A hash (#)

d)

A colon (:)

13.

Why might a web developer use a class selector in CSS?

a)

To style a subset of elements without changing the others

b)

To style all elements of a certain type

c)

To apply styles to the entire document

d)

To remove styles from elements

14.

Given the CSS rule .highlight { color: yellow; }, which HTML element will be affected?

a)

Any element with class 'highlight'

b)

All paragraph elements

c)

All list items

d)

Any element with id 'highlight'

15.

If you want to style all paragraphs and all list items in dark cyan, which CSS selector should you use?

a)

p,li

b)

p li

c)

p.highlight

d)

li p

16.

What is the correct way to assign a CSS class named 'beginner' to a paragraph element in HTML?

a)

This is a beginner paragraph.

b)

This is a beginner paragraph.

c)

This is a beginner paragraph.

d)

This is a beginner paragraph.

17.

Which CSS rule will color all list items with the class 'intermediate' in orange?

a)

li.intermediate { color: orange; }

b)

.intermediate li { color: orange; }

c)

li#intermediate { color: orange; }

d)

.intermediate { color: orange; }

18.

In CSS, what is the difference between '.beginner' and 'li.beginner'?

a)

.beginner selects all elements with the class 'beginner', while li.beginner selects only list items with the class 'beginner'.

b)

.beginner selects only paragraphs with the class 'beginner', while li.beginner selects all elements with the class 'beginner'.

c)

.beginner selects all elements with the id 'beginner', while li.beginner selects only list items with the id 'beginner'.

d)

.beginner selects only list items with the class 'beginner', while li.beginner selects all elements with the class 'beginner'.

19.

What will be the color of the text for a list item with class 'advanced' if the following CSS is used? li.advanced { color: red; }

a)

Red

b)

Green with a red border

c)

Orange

d)

Blue

20.

How can you assign more than one class to an HTML element?

a)

By listing multiple class names separated by spaces in the class attribute, like class="beginner highlighted".

b)

By using multiple class attributes in the element, like class="beginner" class="highlighted".

c)

By separating class names with commas in the class attribute, like class="beginner, highlighted".

d)

By using a semicolon between class names in the class attribute, like class="beginner; highlighted".

21.

Refer to the browser output image showing three colored list items labeled 'Sample 01', 'Sample 02', and 'Sample 03'. Which CSS class is responsible for making 'Sample 02' appear in orange?

a)

intermediate

b)

beginner

c)

advanced

d)

highlighted

22.

If you want to apply a style only to list items with the class 'beginner', which selector should you use in your CSS?

a)

li.beginner

b)

.beginner li

c)

li#beginner

d)

#beginner li

23.

Which symbol is used in CSS to select an element by its id?

a)

A hash (#) character

b)

A dot (.) character

c)

A colon (:) character

d)

A dollar ($) character

24.

What is the main reason for using the id selector in CSS?

a)

To select one unique element on a page

b)

To select all elements of a certain type

c)

To select elements by their class

d)

To select elements by their tag name

25.

Which CSS property is used to change the color of text in a header element?

a)

color

b)

font-family

c)

background-color

d)

text-align

26.

In the CSS code shown, which font is applied to the h1 and h2 headers?

a)

Georgia

b)

Arial

c)

Times New Roman

d)

Verdana

27.

What is the correct way to write a comment in CSS?

a)

/* This is a comment */

b)

// This is a comment

c)

<!-- This is a comment -->

d)

# This is a comment

28.

How many standard color names are supported by CSS/HTML?

a)

140

b)

100

c)

256

d)

16

29.

Which of the following is NOT a valid way to specify a color in CSS?

a)

Binary value

b)

RGB value

c)

HEX value

d)

Predefined color name

30.

Which of the following is a valid named color in CSS?

a)

DodgerBlue

b)

BrightBlue with extra saturation

c)

Blue

d)

LightBlue with high intensity

31.

What is the effect of the following CSS code: color: DodgerBlue; background-color: lightyellow;

a)

The text color will be DodgerBlue and the background will be lightyellow.

b)

The background will be DodgerBlue and the text will be lightyellow.

c)

Both the text and background will be DodgerBlue.

d)

Both the text and background will be lightyellow.

32.

Which CSS property is used to set the style of a border?

a)

border-style

b)

border-color

c)

border-width

d)

border-type

33.

In CSS, which formula is used to specify a color using the RGB model?

a)

rgb(red, green, blue)

b)

rgb(intensity, saturation, brightness)

c)

rgb(hue, saturation, lightness)

d)

rgb(blue, green, red)

34.

What color will be displayed by the CSS code rgb(255, 0, 0)?

a)

Red

b)

Black with a red tint

c)

White with a red shade

d)

Gray

35.

If you want to create a shade of gray using the RGB model in CSS, what must be true about the values for red, green, and blue?

a)

All three values must be equal.

b)

Red must be higher than green and blue.

c)

Green must be set to zero.

d)

Blue must be set to 255.

36.

Which CSS property is used to specify an image as the background of an element?

a)

background-image

b)

background-color with image value

c)

background-repeat

d)

background-style

37.

By default, what happens when you set a background image using the background-image property in CSS?

a)

The image is repeated so it covers the entire element

b)

The image is displayed only once in the top left corner

c)

The image is stretched to fill the element

d)

The image is centered and not repeated

38.

Which three properties are used to define a CSS border?

a)

border-width, border-style, border-color

b)

border-radius, border-style, border-image

c)

border-width, border-radius, border-shadow

d)

border-style, border-image, border-spacing

39.

What is the minimum property you must set to display a border in CSS?

a)

border-style

b)

border-width

c)

border-color

d)

border-radius

40.

To create rounded borders in CSS, which property should you use?

a)

border-radius

b)

border-style

c)

border-width

d)

border-color

41.

What do CSS margin properties do?

a)

Create space around elements, outside of any defined borders

b)

Create space inside the borders of elements

c)

Set the width of the border

d)

Set the color of the border

42.

Which value for a CSS margin property allows the browser to automatically calculate the margin?

a)

auto

b)

length

c)

%

d)

inherit

43.

What is the main purpose of CSS padding properties?

a)

To generate space around an element’s content, inside of any defined borders.

b)

To change the color of an element’s border.

c)

To align text within an element.

d)

To set the font size of an element.

44.

Which of the following correctly lists the four sides for which you can set padding in CSS?

a)

Top, left, bottom, right

b)

Top, center, bottom, right

c)

Top, left, middle, right

d)

Top, left, bottom, center

45.

Refer to the diagram showing the four sides of padding in CSS. Which side is represented by the number 3 in the diagram?

a)

Padding-top

b)

Padding-right

c)

Padding-bottom

d)

Padding-left

46.

Which of the following is NOT a part of the CSS box model?

a)

Margin

b)

Border

c)

Padding

d)

Selector

47.

In the CSS box model, what is the area directly inside the border called?

a)

Margin

b)

Padding

c)

Content

d)

Outline

48.

In CSS, what is a generic family?

a)

A group of font families with a similar look, such as 'Serif' or 'Monospace'.

b)

A specific font family like 'Times New Roman' or 'Arial'.

c)

A font style used only for headings.

d)

A color property for fonts.

49.

Which of the following is a Sans-serif font family?

a)

Times New Roman

b)

Georgia

c)

Arial

d)

Courier New

50.

Which font family would you use to ensure all characters have the same width?

a)

Serif

b)

Sans-serif

c)

Monospace

d)

Cursive

51.

What is the difference between a generic family and a font family in CSS?

a)

A generic family is a group of font families with a similar look, while a font family is a specific font like 'Arial'.

b)

A generic family is a specific font, while a font family is a group of fonts.

c)

There is no difference between the two.

d)

A generic family refers to color, while a font family refers to size.

52.

Which CSS property can be used to style a link?

a)

font-family

b)

background

c)

color

d)

All of the above

53.

What does the a:hover state represent in CSS?

a)

A link when the user moves the mouse over it.

b)

A link that has been visited by the user.

c)

A normal, unvisited link.

d)

A link the moment it is clicked.

54.

If you want a link to change color when clicked, which state should you style?

a)

a:link

b)

a:visited

c)

a:hover

d)

a:active

55.

Why is it important to style links differently based on their state in CSS?

a)

It helps users understand which links they have visited, which are active, and which are being hovered over, improving navigation and user experience.

b)

It makes the website load faster.

c)

It increases the number of links on a page.

d)

It prevents links from being clicked.

56.

Which of the following statements about CSS length units is correct?

a)

Length in CSS is expressed as a number followed by a unit, such as 10px or 2em.

b)

Length in CSS is always expressed as a unit followed by a number, such as px10 or em2.

c)

Length in CSS can be expressed with a whitespace between the number and the unit, such as 10 px.

d)

Length in CSS must always use positive numbers; negative lengths are not allowed.

57.

How many types of CSS length units are there, and what are they called?

a)

There are two types: absolute and relative.

b)

There are three types: fixed, flexible, and dynamic.

c)

There is only one type: absolute.

d)

There are four types: pixel, em, rem, and percent.

58.

Which CSS properties commonly use length values?

a)

Width, margin, padding, and font-size.

b)

Color, font-family, and text-align.

c)

Display, position, and float.

d)

Border-style, background-image, and z-index.

59.

What selector can be used to specify the style of the submit button in the code snippet below:

<form>

<label for="fname">First Name</label>

<input type="text" id="fname" name="firstname"/>

<label for="lname">Last Name</label>

<input type="text" id="lname" name="lastname"/>

<label for="country">Country</label>

<select id="country" name="country">

<option value="australia">Australia</option>

<option value="canada">Canada</option>

<option value="usa">USA</option>

</select>

<input type="submit" value="Submit">

</form>

(a)  

60.

The following css block will add a visible black border around all paragraph elements.

p{

border: 1px black;

}

a)

True

b)

False