Putting body background in html | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Putting body background in html

How to put body background in html

11th Apr 2024, 9:18 PM
Cyiza Briand
Cyiza Briand - avatar
3 Answers
+ 2
To set a background for the <body> element in HTML, you can use the background attribute or, preferably, the CSS background property. Here's how you can do it using CSS: https://www.sololearn.com/fr/compiler-playground/WPZ3z0Suq8pE Replace 'your-background-image.jpg' with the path to your background image file. You can also adjust other properties like background color, size, position, etc., according to your needs. This method gives you more flexibility and control over your background compared to using the background attribute directly in the <body> tag.
12th Apr 2024, 12:48 AM
Abiye Gebresilassie Enzo Emmanuel
Abiye Gebresilassie Enzo Emmanuel - avatar
+ 1
You can use either <body background=src> Or Body{ Background:url(src); } Remember to use two forward slash //in src
12th Apr 2024, 3:24 PM
Vidhya Tharan
Vidhya Tharan - avatar