वेबसाइट के वर्ग के अनुसार उसका Background भी बदलना बहुत जरुरी होता है. अक्सर आपने देखा होगा कि कई वेबसाइट का Backgrounds अलग अलग Colors मे होता है या कुछ वेबसाइट के Backgrounds पर Images होते है. Backgrounds का उपयोग Website को और Attractive बनाने के लिए किया जाता है.
CSS का उपयोग करके आप अपनी Website की Body, Image, Font, Heading या किसी भी Element मे Background Color या image को Set सकते है. CSS Background Properties को Elements Background के Effect को Define करने के लिए उपयोग किया जाता है.
यह सभी web Browsers Color और Background Code को Displaye करने में सक्षम है और ध्यान रखें कि Color Enhancements Undesirable Result भी हो सकता है.
HTML आपको Webpage को सजाने के लिये दो अच्छे तरीके प्रदान करता है. जिससे आप अपने Webpage का Background Color या Background Image को आसानी से बदल सकते हो.
<!DOCTYPE html>
<html>
<head>
<title>HTML Background Colors</title>
</head>
<body>
<h2 style="background-color:red">
Background-color set by using red
</h2>
<h2 style="background-color:orange">
Background-color set by using orange
</h2>
<h2 style="background-color:yellow">
Background-color set by using yellow
</h2>
<h2 style="background-color:blue;color:white">
Background-color set by using blue
</h2>
<h2 style="background-color:cyan">
Background-color set by using cyan
</h2>
</body>
</html>
Background Attribute का उपयोग किसी HTML Element मे विशेष रूप से Page Body और Table Backgrounds के Background को नियंत्रित करने के लिए भी किया जा सकता है.
आप अपने HTML Page या Table की के Background को Set करने के लिए एक Image को Specify कर सकते है.
<!DOCTYPE html>
<html>
<head>
<title>HTML Background Images Example </title>
</head>
<body>
<table background = "/images/html.gif" width = "100%" height = "100">
<tr>
<td>This background is filled up with HTML image.</td>
</tr>
</table>
</body>
</html>