CSS MCQs with Answers

30+ CSS MCQs with Answers (2023)

Which property is used to change the background color of an element in CSS?

  • A. font-color
  • B. text-color
  • C. background-color
  • D. color

Answer: C

What is the correct way to add comments in CSS code?

  • A. <!– This is a comment –>
  • B. // This is a comment //
  • C. /* This is a comment */
  • D. <!– This is a comment –>

Answer: C

Which property is used to set the height and width of an element in CSS?

  • A. dimension
  • B. size
  • C. height-width
  • D. height, width

Answer: D

Which CSS property is used to create a border around an element?

  • A. outline
  • B. frame
  • C. border
  • D. border-style

Answer: C

Which property is used to specify the font family in CSS?

  • A. font-family
  • B. text-family
  • C. typeface
  • D. font-style

Answer: A

Which property is used to set the text alignment in CSS?

  • A. align-text
  • B. text-align
  • C. align
  • D. text-position

Answer: B

Which property is used to create a shadow effect around an element in CSS?

  • A. shadow-effect
  • B. box-shadow
  • C. text-shadow
  • D. element-shadow

Answer: B

Which property is used to set the font size in CSS?

  • A. font-size
  • B. text-size
  • C. size
  • D. font-style

Answer: A

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

  • A. font-color
  • B. text-color
  • C. color
  • D. text-style

Answer: C

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

  • A. line-height
  • B. text-spacing
  • C. line-spacing
  • D. letter-spacing

Answer: A

Which CSS property is used to change the font weight?

  • A. font-style
  • B. font-size
  • C. font-weight
  • D. text-weight

Answer: C

Which property is used to set the margin of an element in CSS?

  • A. padding
  • B. space
  • C. margin
  • D. spacing

Answer: C

Which property is used to hide an element in CSS?

  • A. visibility
  • B. display
  • C. opacity
  • D. hidden

Answer: A

Which CSS property is used to specify the position of an element?

  • A. positioning
  • B. location
  • C. position
  • D. place

Answer: C

Which property is used to set the text decoration in CSS?

  • A. font-style
  • B. text-decoration
  • C. decoration
  • D. text-style

Answer: B

Which property is used to set the font style in CSS?

  • A. font-type
  • B. font-style
  • C. typeface
  • D. text-style

Answer: B

Which property is used to set the opacity of an element in CSS?

  • A. transparency
  • B. visibility
  • C. opacity
  • D. alpha

Answer: C

Which CSS property is used to specify the spacing between words?

  • A. text-spacing
  • B. letter-spacing
  • C. word-spacing
  • D. space-between

Answer: C

Which property is used to change the case of text in CSS?

  • A. text-transform
  • B. font-transform
  • C. case-transform
  • D. transform-case

Answer: A

Which property is used to set the vertical alignment of an element in CSS?

  • A. vertical-align
  • B. align-vertical
  • C. element-align
  • D. align-top

Answer: A

Which property is used to set the position of a background image in CSS?

  • A. image-position
  • B. background-position
  • C. position-background
  • D. background-image-position

Answer: B

Which CSS property is used to add a transition effect to an element?

  • A. transition
  • B. effect
  • C. transform
  • D. animation

Answer: A

Which property is used to create a gradient effect in CSS?

  • A. gradient
  • B. color-gradient
  • C. background-gradient
  • D. linear-gradient

Answer: D

Which property is used to set the z-index of an element in CSS?

  • A. index
  • B. z-index
  • C. depth
  • D. layer

Answer: B

Which property is used to add a border-radius to an element in CSS?

  • A. border-radius
  • B. rounded-corner
  • C. corner-radius
  • D. border-corner

Answer: A

Which property is used to set the text overflow behavior in CSS?

  • A. text-overflow
  • B. overflow-text
  • C. text-behavior
  • D. overflow-behavior

Answer: A

Which CSS property is used to add a box shadow effect to an element?

  • A. box-shadow
  • B. shadow-effect
  • C. element-shadow
  • D. object-shadow

Answer: A

Which property is used to set the amount of space between the content and the border in CSS?

  • A. padding
  • B. margin
  • C. space
  • D. distance

Answer: A

Which property is used to set the maximum width of an element in CSS?

  • A. max-width
  • B. width-max
  • C. element-width
  • D. maximum-element-width

Answer: A

Which property is used to set the height of an element to be the same as its width in CSS?

  • A. height-equals-width
  • B. height-and-width
  • C. square
  • D. aspect-ratio

Answer: D

5/5 (1)

Similar Posts