HTML Background Color


It is a very expressive property because it defines the background color for an HTML element.

Example :


<!DOCTYPE html>
<html>
<head>
<style>
body {
    background-color: skyblue
}
</style>
</head>
<body>
</body>
</html>



Which Result is given below it will display on the  web page :









As per your choice, you can add the color you want to display on the web page. There are three ways to enter a color to be displayed.
  1. major colors - red, blue, yellow, green, etc.
  2. hexadecimal  - #255,0,0;
  3. RGB - rgb(#255,0,0)
Example is given below :


<html>
<head>
    <title>text color</title>
    <style type="text/css">
        #example1
        {
            color: red;
        }
        #example2
        {
            color: orange;
        }
    </style>
</head>
<body>
    <p id="example1">
        The sun rises in the east</p>
    <p id="example2">
        fruit name is orange</p>
</body>
</html>



Result is given below :    

Regular foundation course an green   background


Regular classroom programmes a orange  background




No comments:

Post a Comment

Please do not enter any spam link in the comment box.

Related Posts

What is the Use of isNaN Function in JavaScript? A Comprehensive Explanation for Effective Input Validation

In the world of JavaScript, input validation is a critical aspect of ensuring that user-provided data is processed correctly. One indispensa...