wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Css questions

Total questions: 20

Worksheet time: 20mins

Name
Class
Date
1.

What is the default value of the position property in CSS?

a)

absolute

b)

absolute

c)

static

d)

fixed

2.

Which CSS property is used for changing the text color?

a)

font-color

b)

color

c)

text-color

d)

text-style

3.

What does the CSS property opacity control?

a)

Element transparency

b)

Border thickness

c)

Background color

d)

Text shadow

4.

Which CSS property is used for creating rounded corners?

a)

border-radius

b)

corner-radius

c)

curve-border

d)

round-corner

5.

How can you center an element horizontally in CSS?

a)

text-align: center

b)

margin: auto

c)

position: center

d)

align: center

6.

Which CSS property is used to set the spacing between lines of text?

a)

letter-spacing

b)

text-spacing

c)

line-height

d)

word-spacing

7.

What is the purpose of the CSS property z-index?

a)

Define the stacking order of elements

b)

Set the font size

c)

Adjust the element's width

d)

Control the transparency of an element

8.

How can you hide an element in CSS without affecting the layout?

a)

opacity: 0

b)

visibility: hidden

c)

hidden: true

d)

display: none

9.

What does the CSS property margin: auto; do?

a)

Centers the element horizontally and vertically within its container.

b)

Adds equal margins to all sides of the element.

c)

Only adds a top margin to the element.

d)

Does not affect the element's margin.

10.

How can you set a background image in CSS?

a)

background-color: image-url('background.jpg');

b)

image: url('background.jpg');

c)

background-image: url('background.jpg');

d)

bg-image: 'background.jpg';

11.

What does the CSS property position: relative; do?

a)
  • Positions the element relative to its normal position in the document flow

b)

Aligns the element to the right of its container.

c)

Fixes the element's position to the viewport.

d)

Removes the element from the document flow.

12.

What does the CSS property overflow: hidden; do?

a)

Expands the element to fill the entire viewport.

b)

Clips any content that overflows the element's box.

c)

Adds a shadow to the element

d)

Makes the element's content visible outside its box.

13.

What does the CSS property overflow: hidden; do?

a)

Expands the element to fill the entire viewport.

b)

Clips any content that overflows the element's box.

c)

Adds a shadow to the element

d)

Makes the element's content visible outside its box.

14.

How can you select all links within a specific div with the class "menu"?

a)

div.menu a { }

b)

.menu a { }

c)

div .menu a { }

d)

div > a.menu { }

15.

How can you hide an element from the screen but keep it accessible for screen readers?

a)

visibility: hidden;

b)

display: none;

c)

opacity: 0;

d)

position: absolute; left: -9999px;

16.

How can you set the background color of an element to a transparent value?

a)

background-color: transparent;

b)

background: none;

c)

background-opacity: 0;

d)

opacity: 0;

17.

How do you select all <p> elements that are children of a <div> using CSS?

a)

div p {}

b)

div > p {}

c)

div ~ p {}

d)

div + p {}

18.

What does the CSS property box-sizing: border-box; do?

a)

Adds padding and border to the content width.

b)

Includes padding and border within the element's total width.

c)

Removes padding and border from the element.

d)

Sets the size of the element's box to zero.

19.

How can you vertically align an inline element?

a)

vertical-align: middle;

b)

margin-top: auto; margin-bottom: auto;

c)

position: relative; top: 50%; transform: translateY(-50%);

d)

line-height: 2;

20.

How can you apply a shadow to text in CSS?

a)

Using the font-shadow: 1px 1px #888; property.

b)

Using the text-shadow property.

c)

Applying the shadow: 2px 2px 2px #000; property.

d)

Utilizing the box-shadow property.