CSS3 > Background

Background-image Property in CSS3

How to set a background image for the HTML body element in CSS3?


By using background-image property we can set a background image for the HTML <body> element.

 <style>
        body {
            background-image: url("Background-Website3.jpg");
        }

        p {
            color: yellow;
        }
</style>

<body>
    <p>I am an INDIAN</p>
    <p>I am an INDIAN</p>
    <p>I am an INDIAN</p>
    <p>I am an INDIAN</p>
    <p>I am an INDIAN</p>
    <p>I am an INDIAN</p>
    <p>I am an INDIAN</p>
    <p>I am an INDIAN</p>
    <p>I am an INDIAN</p>
    <p>I am an INDIAN</p>
    <p>I am an INDIAN</p>
    <p>I am an INDIAN</p>
    <p>I am an INDIAN</p>
    <p>I am an INDIAN</p>
    <p>I am an INDIAN</p>
</body>

In the above code snippet we have given background-image property to the <body> element, so that it sets the background image to the total  <body> element.

OUTPUT

 Views: 3242 | Post Order: 47



Write for us






Hosting Recommendations