Как задать цвет страницы в html
In this article, we will see how to set the background color of an element. The purpose of using style attribute is to add styles to the elements. Using style attribute with different elements results in change in that element only. This attribute can be used as inline, internal or external. The style attribute provides number of properties which can be used to improve a simple html page.
The background color can be changed in three ways:
- Inline style attribute
- Internal CSS
- External CSS
The HTML5 doesn’t support the ‘bgcolor’ attribute of <body> tag, therefore we need to use the inline style attribute and internal CSS options for changing the color of a web page. For internal CSS add <style> tag at beginning of html file and add the tag to which the changes are being applied in this case the <body> tag is used.
Syntax:
Example 1: Below is the example that illustrates the use of inline CSS.