CSS - Background Color


CSS - Background Color

  • Background Color is used to set the background color of an   element like <p>, <h1>, <h2> and so on.

Sample Code :

<html>
<head>
    <body>

        <p style = "background-color: green;">
            Wikitechy Is the Best E-Learning Website.
        </p>
    </body>
</head>
<html>

Code Explanation :


    Here “background-color: green;” is used to set green background color for the paragraph.

Output :


    Opening the html file, the web browser displays the paragraph “Wikitechy Is The Best E-Learning Website.” with its background as green color.