Which property is used to change the background color?
To set the background color in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <body> tag, with the CSS property background-color. HTML5 do not support the <body> tag bg-color attribute, so the CSS style is used to add background color. The bg-color attribute deprecated in HTML5.
Just keep in mind that the usage of style attribute overrides any style set globally. It will override any style set in the HTML <style> tag or external style sheet.
You can try to run the following example code to set the background color in HTML,
<!DOCTYPE html>
<html>
<head>
<title>Set HTML Backgorund Color</title>
</head>
<body style="background-color:red;">
<h1>Cources</h1>
<p>We have developed and make it live around 20 Courses and 5 tutorials till now in SlightBook.</p>
</body>
</html>
How do you insert a comment in a CSS file?
Which is the correct CSS syntax?
Which HTML attribute is used to define inline styles?
Which HTML tag is used to define an internal style sheet?
Where in an HTML document is the correct place to refer to an external style sheet?