How to set background-image for the body element using CSS ? Last Updated : 15 Mar, 2023 Comments Improve Suggest changes Like Article Like Report 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 in 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 the background image. Example 1: HTML <!DOCTYPE html> <html> <head> <title> How to set background-image for the body element using CSS ? </title> <style> body { background-image: url( "https://media.geeksforgeeks.org/wp-content/cdn-uploads/CSS.png"); text-align: center; } </style> </head> <body> <h1 style="color: white;"> GeeksforGeeks </h1> <h3> Set background-image for the body element </h3> </body> </html> Output: Example 2: So in this example, we will see how to set the background image using CSS styling. using the absolute URL. as you can see in the code. Syntax : body { background-image: url('http image link '); background-size: cover; } HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> body { background-image: url( https://media.geeksforgeeks.org/wp-content/uploads/20230315170105/gfg1.png); background-color: black; border-image-width: 400px; background-size: cover; } h1, h3 { text-align: center; margin: 40px auto; color: rgb(255, 255, 255); } </style> </head> <body> <h1> GeeksforGeeks !</h1> <h3> Background image for the body element </h3> </body> </html> Description: In the above code we use the HTML tag such as the heading inside the body tag. and create the two headings. and add the CSS where we used the background-image property to set the URL of the background image. And the background-size property sets the size of the background image to cover the entire background area of the body element. Overall, this code demonstrates how to set a background image for the body element using CSS. Output: Supported Browsers: Google Chrome 1.0Edge 4.0Firefox 1.0Opera 3.5Safari 1.0 Comment More infoAdvertise with us Next Article How to set background-image for the body element using CSS ? V vkash8574 Follow Improve Article Tags : Web Technologies CSS CSS-Questions Similar Reads How to combine background-image and gradient on the same element using CSS3 ? Cascading Style Sheets fondly referred to as CSS, is a simply designed language intended to simplify the process of making web pages presentable. CSS allows you to apply styles to web pages. More importantly, CSS enables you to do this independent of the HTML that makes up each web page. It describe 2 min read How to Fit Background Image to Div using CSS? To fit a background image to a div using CSS, you can utilize the background-size property. Here are some approaches:1. Using background-size: cover;This method scales the background image to cover the entire div, maintaining the image's aspect ratio.HTML<html> <head> <style> .back 2 min read How to Add filter to the background image using CSS? Adding filters to background images using CSS allows you to apply visual effects like blur, grayscale, brightness adjustment, and more without modifying the actual image file. CSS provides a set of filter functions that can be applied to elements with background images. This approach enhances design 3 min read How to Set Offset of Background Image from Right using CSS ? In this article, you can see the ways by which you can set the offset of a background image from the right using CSS. The approach solving involves the use of the CSS background positioning property of background-position. This property is essentially used to specify the space from which the backgro 2 min read How to blur background image using CSS ? CSS (Cascading Style Sheets) is a language used to describe the appearance and formatting of a document written in HTML. In this article, we will learn how to blur background images using CSS, along with basic implementation examples. Blurring Background Images with CSSTo blur a background image usi 3 min read Like