Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to set background-image for the body element using CSS ?

  • Last Updated : 23 Dec, 2020

In this article, we set the image into the background using CSS property. The background-image property is used to set one or more background images to an element. By default, it places the image on the top left corner. To specify two or more images, separate the URLs with a comma.

Syntax:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

background-image: url("url");

Property value: It holds the URL of an image that you want to use as background image.

Example:



HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to set background-image for
        the body element using CSS ?
    </title>
  
    <style>
        body {
            background-image: url(
            text-align: center;
        }
    </style>
</head>
  
<body>
    <h1 style="color: white;">
        GeeksforGeeks
    </h1>
  
    <h3>
        Set background-image for
        the body element
    </h3>
</body>
  
</html>

Output:

Supported Browsers:

  • Google Chrome 1.0
  • Edge 4.0
  • Firefox 1.0
  • Opera 3.5
  • Safari 1.0
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!