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

Master the Revature Interview Test with our comprehensive study guides. Access quizzes with multiple choice questions enhanced by hints and explanations. Ace your exam!

The property used to change the text color of an element in CSS is "color." This property directly targets the color of the text content within an element and accepts various color formats, including named colors, HEX, RGB, RGBA, HSL, and HSLA values.

For example, if you have a paragraph element and want to set its text color to blue, you can do so with the following CSS:


p {

color: blue;

}

This will result in all text within the paragraph tags being displayed in blue.

While there are other properties related to text and colors in CSS, such as "background-color," which affects the background behind the text, these do not influence the text's actual color itself. Similarly, options like "font-color" and "text-color" do not exist in standard CSS, making them invalid choices for setting the text color.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy