HTML For Beginners The Easy Way : Start Learning HTML & CSS Today.
Welcome to Learn HTML, the easiest way to learn HTML & CSS.
How to set background color in HTML?
You wanted to change the background color of a web page or an element , You would have simply added the background-color property. Set it to the color name or code you want and place it inside a style attribute. Then add this style attribute to an HTML element.
For example the background color of a web page:
style=”background-color : red”
Then add this style attribute to an HTML element:
<body style=”background-color: red”>
For example the background color of an element <div>:
<div style=”background-color : green”>Green</div>
<div style=”background-color : #9A3BA3">#9A3BA3</div>
<div style=”background-color : aqua”>Aqua</div>