Basic CSS

February 28, 2021 By Temani Afif

This a training quiz. There is no timer so take your time to answer the questions.
You will get the correct answers at the end.

Your Result


Great! you are now ready to tackle the real quiz:

#1 padding: 0 20px 0 0; is equivalent to

When used with 4 values, padding means [top right bottom left] so the correct answer is “padding-right:20px;”. “padding” is called the shorthand property and “padding-right” the longhand one.

Documentation & Specification

#2 How to correctly define media query?

#3 Which selector has the highest specificity?

#4 Which of the following is an inherited property?

color is an inherited property. To check if a propery is inherited or not you can:

Check its MDN page

Check the Specification

#5 How to select all the elements?

We use the “*” [asterisk symbol] called “univeral selector”.

Documentation & Specification

#6 What is the default value of the box-sizing property?

The default value is content-box. Each property has a default value (also called initial value) that you can find

Within its MDN page

Within the specification

#7 Which CSS property can be used with negative values?

In this list only “margin” can be used with negative value. Many properties accept negative value and such information is implicit unless defined otherwise so in most of the case we try to search for “negative values are invalid with XX” instead of “negative value are allowed for XX”

For padding:

Negative values for padding properties are invalid.

For width:

Negative values are invalid.

There is no generic rule. It depends on each property.

#8 How to clear float?

#9 Which of the following is a valid pseudo element?

Only “::before” is the valid one here.

Documentation & Specification

PS: do not confuse “pseudo element” (like ::before) with “pseudo classes” (like ::hover)

#10 Which of the following is an invalid value of the display property?

“inline-float” doesn’t exist. Each property has a set of defined values (also called the syntax of the property).

From the specification


The Same information can also be found within the MDN page:

I am done
Twitter Buy Me A Coffee