How can you set background color to red?
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>


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
Sign Up Now
or Subscribe for future quizzes