👻 Check our latest review to choose the best laptop for Machine Learning engineers and Deep learning tasks!
CSS can be intimidating, even for experienced developers - there are so many options ! But in this article, we will see how to change the background color in the HTML document without creating a separate cascading style sheet.
When using HTML5, you can add a background color using the style attribute and the ’background-color’ property. You can implement this attribute on the element you prefer; however, to set the background color for the entire page, the style attribute must be in the body tag. Your HTML code might look like this:
This code gives us an HTML page with an orange background.
Getting implement additional web color schemes

When selecting your color in HTML, the attribute style accepts hex codes, HTML color names, RGB (A) color values, and HSL color values. In the case of RGB colors and HSL colors, the color systems must be included in the background color declaration.
Below are some formatting examples for each color system:
Hexadecimal code
HTML color name
RGB color values ​​