Setting the Background Color

You can enhance or modify the background of an HTML element by changing its background color. The background-color property allows you to set the background color of an HTML element.

Let’s do the following steps to set the background color of an HTML element:


<!DOCTYPE html>
<html>
<head>
    <title> Setting a Background Color</title>
<style type=”text/css”>
body {background-attachment:fixed;
    background-image:url(images/ballooms.jpg); background-position:500px;}
    p{font-family: Georgia; font-size: large;
    color: #ff0000; background-color:#fde283;}
</style>
</head>
<body>
    <p>Using CSS, you can add the background color, image and its positioning,
    You can use the background property at once.
    The background color of the web page is yellow, image is set at the background of 
    the web page. Now, the paragraph is 
    color with orange and set yellow in the background.
    </p>
</body>
</html>

Save the document with the name BackgroundImage.html and open on browser.

In this section, you learn about how to work with text properties. You also learn how to color and indent the text. In addition to this, you also learn to align and decorate the text.

Let’s now learn about the text properties and how to work with it.