Q
Which CSS property is used to specify the background color of an element?

Answer & Solution

Answer: Option A
Solution:
The 'background-color' property in CSS is used to specify the background color of an element.
Related Questions on Average

What is the purpose of the CSS box model?

A). A) To provide a graphical representation of CSS rules

B). B) To define the layout and design of a webpage

C). C) To control the appearance of text

D). D) To specify the padding and border of an element

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

A). A) line-height

B). B) text-spacing

C). C) line-spacing

D). D) spacing

What is the purpose of CSS media queries?

A). A) To create animations for different screen sizes

B). B) To specify the layout for different devices

C). C) To control the appearance of text

D). D) To optimize CSS performance for mobile devices

Which CSS unit is based on the font size of the root element?

A). A) em

B). B) px

C). C) %

D). D) vw

Which CSS property is used to align text within its container horizontally?

A). A) text-align

B). B) align-text

C). C) text-justify

D). D) justify-text

Which of the following is NOT a valid CSS selector?

A). A) #myDiv .class

B). B) 1stParagraph

C). C) .myClass > p

D). D) p + span

Which CSS property is used to add shadows to elements?

A). A) box-shadow

B). B) shadow

C). C) text-shadow

D). D) element-shadow

Which CSS property is used to specify the font family of text?

A). A) font-family

B). B) text-family

C). C) font-type

D). D) text-font

What does the CSS property 'display: none;' do?

A). A) Hides the element but reserves its space

B). B) Hides the element and removes its space

C). C) Shows the element

D). D) Displays the element with reduced opacity

What does the CSS property 'position: fixed;' do?

A). A) Positions the element relative to its parent

B). B) Positions the element relative to the viewport

C). C) Positions the element absolutely

D). D) Positions the element relative to the document flow