HTML (Hypertext Markup Language) allows you to set a background image for your web page. Here are the steps to add a background image in HTML:
- Open your HTML file in a text editor.
- Add the following CSS code to your HTML file:
<style>
body {
background-image: url("your-image-file-name.jpg");
background-repeat: no-repeat;
background-size: cover;
}
</style>
In this code, replace “your-image-file-name.jpg” with the file name and extension of the image you want to use.
- Save the file and open it in your web browser.
The background-image property sets the image as the background of the entire page, while background-repeat determines whether the image should be repeated horizontally, vertically, or not at all. The background-size property determines how the image should be sized to fit the screen.
You can also set a background image for specific elements of your page, such as a div or section, by using the same CSS code but changing the selector from body to the appropriate element.
