How do you change the text color of an element?

  1. text-color:

  2. color:

  3. text-color=

  4. fgcolor:


Correct Option: B

AI Explanation

To change the text color of an element, you can use the CSS property called "color".

The correct answer is B) color.

Explanation for each option:

Option A) text-color: This option is incorrect because there is no CSS property called "text-color". The correct property to change the text color is "color".

Option B) color: This option is correct. The "color" property is used to change the text color of an element. You can specify the color value using various formats such as color names (e.g., "red", "blue"), hexadecimal codes (e.g., "#FF0000"), or RGB/RGBA values (e.g., "rgb(255, 0, 0)", "rgba(255, 0, 0, 0.5)").

Option C) text-color=: This option is incorrect because the correct syntax for the "color" property does not include an equals sign (=). The correct syntax is "color: value;".

Option D) fgcolor: This option is incorrect because there is no CSS property called "fgcolor". The correct property to change the text color is "color".

Therefore, the correct answer is B) color.

Find more quizzes: