Skip to content
Related Articles

Related Articles

How to set background-image for the body element using CSS ?
  • Last Updated : 23 Dec, 2020
GeeksforGeeks - Summer Carnival Banner

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:

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

full-stack-img

My Personal Notes arrow_drop_up
Recommended Articles
Page :