Document.bgcolor property can be set to any appropriate color.
To set the background color of an HTML document, you can use the CSS background-color
property. Here’s how you would do it:
html
<html>
<head>
<title>Background Color Example</title>
<style>
body {
background-color: #ffcc00; /* You can use color names, hex values, RGB values, etc. */
}
</style>
</head>
<body>
<p>This is a sample text.</p>
</body>
</html>
In the above example:
- We’ve used the
<style>
tag within the<head>
section to define CSS rules. - The
body
selector targets the<body>
element of the HTML document. - The
background-color
property sets the background color to#ffcc00
, which is a shade of yellow.
You can replace #ffcc00
with any valid color value according to your design preferences.