How To Set Background Color In HTML? - Tutorialspoint
Có thể bạn quan tâm
Setting the background color of a web page or an element on the web page, enable us to create unique layouts for the web page.
To set the background color in HTML, use the style attribute, with the CSS property background-color inside the body tag of the HTML document.
HTML5 do not support the <body> tag bgcolor attribute, so the CSS style is used to add background color. The bgcolor attribute deprecated in HTML5.
We can change the background color by overriding the property with the other property.
Syntax
<body style="background-color:aquamarine;">Example
Following is the example program to set background color in HTML.
<!DOCTYPE html> <html> <body style="background-color:aquamarine;"> <h1>HTML Articles</h1> </body> </html>We can change the background color by overriding the property with the other color.
Example
Following is the example program to set background color in HTML.
<!DOCTYPE html> <html> <body style="background-color:khaki;"> <h1>HTML Articles</h1> </body> </html>We can specify the background color with RGB value. RGB value indicates its red, green, and blue color intensity. Each intensity value is on a scale of 0 to 255, or in hexadecimal from 00 to FF.
Example
Following is the example program to set background color with RGB value.
<!DOCTYPE html> <html> <head> <style> body { background-color: rgb(20,30, 1); } </style> <h1>HTML Articles</h1> </head> <body> </body> </html>![Lokesh Badavath](https://www.tutorialspoint.com/assets/profiles/538106/profile/60_1039031-1666073315.jpg)
233K+ Views
- How to set background color in jQuery?
- How to set default background color for JTextPane in Java?
- How to set font color in HTML?
- How to set the background color of a ttk.Combobox in tkinter?
- How to set background color of a View in iOS App?
- How to set background color of a view in Android App
- How can we set a background color to JSplitPane in Java?
- How to set background color of a particular div in jQuery?
- How to display the background color of an element in HTML?
- How can we set the background color to a JPanel in Java?
- How to set the background color for an element using jQuery?
- Changing three.js background to transparent or another color in HTML
- How to set background color of an android activity to yellow Programatically?
- How to set a particular color as background to a JavaFX chart?
- How to set the background color of a column in a matplotlib table?
Kickstart Your Career
Get certified by completing the course
Get StartedTừ khóa » Html Cool Background Colors
-
List Of Common HTML Color Codes
-
Color Trends - W3Schools
-
HTML Color Groups - W3Schools
-
HTML Background Color - HTML Color Codes
-
CSS/Properties/color/keywords - W3C Wiki
-
Colors - A Nicer Color Palette For The Web.
-
50 Beautiful Website Color Schemes & CSS Hex Codes 2022
-
How To Add & Change Background Color In HTML - HubSpot Blog
-
50 Gorgeous Color Schemes From Stunning Websites - Visme
-
#8C92AC Hex Color Cool Grey For HTML And CSS
-
10 Trending 2022 Website Color Schemes - QuickSprout
-
HTML Color Codes And Names - Computer Hope
-
How To Change Background Color In HTML? - Top 5 Methods That ...