Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Web Design Standard 5: CSS Styling Techniques Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Which of the following best describes the difference between an inline style and an external style sheet in CSS?

a)

Inline styles are written in a separate file, while external style sheets are written within the HTML tag.

b)

Inline styles are applied directly to HTML elements using the "style" attribute, while external style sheets are linked to the HTML file and stored separately.

c)

Inline styles can only be used for text formatting, while external style sheets can only be used for layout.

d)

Inline styles are used for JavaScript, while external style sheets are used for HTML.

2.

Given the following CSS selector, what elements will be affected? ```css nav ul li a { color: blue; } ```

a)

All anchor tags in the document

b)

All anchor tags that are inside a list item within an unordered list inside a nav element

c)

All unordered lists inside a nav element

d)

All list items inside a nav element

3.

Which of the following is the correct way to link an external CSS file named "styles.css" to your HTML document?

a)

<link type="text/css" href="style.css">

b)

<link rel="stylesheet" href="style.css">

c)

<href="style.css">

d)

<link rel="stylesheet" type="text/css" href="style.css">

4.

A web designer wants to ensure that the text size on their website adjusts relative to the user's browser settings. Which CSS unit should they use for font size?

a)

px

b)

em or rem

c)

cm

d)

in

5.

You are given a web page where the text overflows its container. Using CSS, how would you create a region to manage the text flow and prevent overflow?

a)

Use `overflow: visible;`

b)

Use `overflow: hidden;` or `overflow: auto;` on the container

c)

Use `display: none;`

d)

Use `position: absolute;`

6.

You are designing a portfolio website and want to use both a header-located style and an external style sheet. How would you ensure that the external style sheet styles are applied, but can be overridden by styles in the header?

a)

Place the external style sheet link after the header style block

b)

Place the header style block after the external style sheet link

c)

Use only the external style sheet

d)

Use only the header style block

7.

You are tasked with creating a navigation bar where the background color of the navigation links changes when hovered over. Which CSS selector and property would you use?

a)

`nav a:active { background-color: red; }`

b)

`nav a:hover { background-color: red; }`

c)

`nav a:visited { background-color: red; }`

d)

`nav a:focus { background-color: red; }`

8.

A client wants their website to be accessible and readable on all devices. How would you use CSS to ensure that text size and layout adapt to different screen sizes?

a)

Use fixed pixel values for all elements

b)

Use relative units (em, rem, %) and media queries to adjust styles based on screen size

c)

Use only inline styles

d)

Use only absolute positioning

9.

You are preparing to upload your completed web pages to your online career portfolio. Which of the following steps is most important to ensure your CSS files are correctly linked and displayed?

a)

Only upload the HTML files

b)

Upload both the HTML and CSS files, and verify the file paths in the HTML link tags

c)

Upload only the CSS files

d)

Use inline styles for all elements

10.

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