HTML में किसी एलिमेंट का बैकग्राउंड रंग सेट करने के लिए bgcolor एट्रिब्यूट का उपयोग किया जाता था। यह विशेष रूप से पेज बॉडी और टेबल बैकग्राउंड को नियंत्रित करता था।
नोट: यह एट्रिब्यूट HTML5 में समर्थित नहीं है।
उदाहरण
bgcolor एट्रिब्यूट लागू करना सीखें:
<!DOCTYPE html>
<html>
<head>
<title>HTML Background Colors</title>
</head>
<body>
<!-- Format 1 - Use color name -->
<table bgcolor="yellow" width="100%">
<tr>
<td>This background is yellow</td>
</tr>
</table>
<!-- Format 2 - Use hex value -->
<table bgcolor="#6666FF" width="100%">
<tr>
<td>This background is sky blue</td>
</tr>
</table>
<!-- Format 3 - Use RGB value -->
<table bgcolor="rgb(255,0,255)" width="100%">
<tr>
<td>This background is magenta</td>
</tr>
</table>
</body>
</html>
आधुनिक तरीका: CSS background-color प्रॉपर्टी का उपयोग करें:
<table style="background-color: yellow;">...</table> <body style="background-color: #f0f0f0;">...</body>