wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CW412 PART III

Total questions: 25

Worksheet time: 20mins

Name
Class
Date
1.

The box-sizing property allows you to define how the width and height of an element are calculated.

  • Which value includes padding and border in the width and height calculations?

a)

  • content-box

b)

  • border-box

c)

  • padding-box

d)

  • margin-box

2.

What is the difference between an ID selector and a class selector?

a)

An ID selector and a class selector both target a specific element based on its unique attribute, but an ID selector is used for classes and a class selector is used for IDs.

b)

An ID selector and a class selector both target multiple elements with the same attribute, but an ID selector is used for classes and a class selector is used for IDs.

c)

An ID selector targets multiple elements with the same ID attribute, while a class selector targets a specific element based on its unique class attribute.

d)

An ID selector targets a specific element based on its unique ID attribute, while a class selector targets multiple elements with the same class attribute.

3.

You can combine selectors using commas (,) to target elements with multiple conditions.

  • Which code snippet selects all <p> elements with the class "important" that are descendants of a <div> with the ID "content"?

a)

p.important #content div

b)

div#content p.important

c)

#content .important p

d)

#content div p.important

4.

What property defines the margin around an element and separates it from the content or neighboring elements?

a)

margin

b)

spacing

c)

border

d)

padding

5.

The box-sizing property allows you to define how the width and height of an element are calculated.

Which value includes padding and border in the width and height calculations?

a)

content-box

b)

margin-box

c)

padding-box

d)

border-box

6.

How can you collapse the top and bottom margins of adjacent elements to prevent unwanted spacing?

a)

Use margin-collapse: collapse

b)

Use the 'border-spacing' property

c)

Apply padding instead of margin

d)

Set 'display: inline-block' on the elements

7.

The flex-direction property in Flexbox controls the direction of the flex items within the container.

Which value will display the items in a row from left to right?

a)

column

b)

reverse-row

c)

right-to-left

d)

row

8.

Which of the following positioning values removes an element from the normal document flow and allows absolute positioning?

a)

absolute

b)

static

c)

relative

d)

fixed

9.

In the box model, what property defines the padding around an element's content?

a)

margin

b)

border

c)

outline

d)

padding

10.

Which of the following positioning values removes an element from the normal document flow and allows absolute positioning?

a)

static

b)

fixed

c)

absolute

d)

relative

11.

What does the position property in CSS control?

a)

The font size of an element.

b)

The background color of an element.

c)

The type of positioning method used for an element.

d)

The margin around an element.

12.

Which positioning value makes an element stay in place even when the page is scrolled?

a)

fixed

b)

absolute

c)

sticky

d)

relative

13.

Choose the answer that best describes each CSS selector type.

Element selectors (sometimes called type selectors):

a)

Selects elements with a specific class

b)

Selects elements based on their position in the DOM

c)

Selects elements based on their attributes

d)

Selects all elements of the specified type.

14.

Choose the answer that best describes each CSS selector type.

Class selectors:

a)

Select elements with a specific id attribute

b)

Select elements with a specific class attribute

c)

Select elements based on their tag name

d)

Select elements with a specific data attribute

15.

Choose the answer that best describes each CSS selector type.

ID selectors:

a)

Selects an element with a specific ID attribute

b)

Selects elements based on their class attribute

c)

Selects all elements on the page

d)

Selects elements based on their tag name

16.

To style all <p> elements on a webpage, you would use a(n) (a)   selector.

17.

If you want to target a specific button with the class name "submit", you would use the (a)   selector.

18.

Highlighting a link when the user hovers over it can be achieved with the (a)   pseudo-class.

19.

The default value for background-repeat is:

a)

infinite

b)

once

c)

repeat

d)

no-repeat

20.

To create a solid border around an element in CSS, you would use the shorthand property (a)   and specify the width, style, and color of the border.

21.

The individual properties for border include border-width, border-style, and border-color. To set a dashed border, you would set the border-style property to (a)   .

22.

By default, borders are applied to all four sides of an element. You can target specific sides using properties like border-top, border-right, border-bottom, and border-left. To style only the bottom border of an element, you would use the property (a)   .

23.

In CSS, the value border-collapse: collapse can be used to collapse the margins of adjacent borders. This is useful for creating tables or other elements with borders that touch. To achieve this effect, you would set the border-collapse property to (a)   .

24.

Borders can also be used to create rounded corners on elements. The border-radius property allows you to define the curvature of the corners. To create a rounded border with a radius of 10 pixels, you would set the border-radius property to (a)   .

25-28.

Scenario: You're building a website with a game where adorable frogs need to jump on lilypads. Flexbox is the perfect layout tool to position the lilypads in a row. But uh oh, some frogs are misplaced!

Instructions: Use your Flexbox knowledge to answer the following questions and help the frogs reach their lilypads!

25.

The frogs currently appear left to right. How can you use Flexbox to display them in reverse order (right to left)?

(a)  

26.

The frogs are currently chilling on the top edge of the lilypads. How can you use Flexbox to center them vertically within the container?

(a)  

27.

The frogs are a bit too close together. How can you use Flexbox to add some space between them? (do no use margins)

(a)  

28.

What if you want the frogs to behave differently on larger screens? Flexbox offers a way to set conditions based on screen size. You can create a _____ _______

(a)