How can you set background color to red?
Explanation
Changing the default style of an HTML element, can be done with the style attribute.
The HTML style attribute has the following syntax:

<ANYTAGNAME style="property:value"> </ANYTAGNAME>

Tip:

This is an example of inline-style.
But use CSS styling with classes nowdays!


HTML code:

<ANYTAGNAME class="backgroundRed"> </ANYTAGNAME>

CSS classes:
.backgroundRed {
    background-color: red;
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
HTML & CSS quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes