Multiple choice technology web technology

How do you change the text color of an element?

  1. fgcolor:

  2. text-color:

  3. color:

  4. text-color=

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The CSS property for changing text color is simply 'color:', not 'text-color' or 'fgcolor'. This is a common point of confusion for beginners who expect more descriptive names.

AI explanation

In CSS, the color property sets the foreground/text color of an element (e.g., color: red;), while background-color controls the background. fgcolor: isn't valid CSS syntax (it's reminiscent of the old deprecated HTML attribute bgcolor/text, not a CSS property). text-color: and text-color= are not real CSS properties at all - a common beginner mistake, since CSS uses color, not a compound text-color name, and CSS declarations always use a colon, not an equals sign, ruling out the = variant as well. So color: is the only syntactically and semantically correct answer.