How do you set a jpg as a background in html? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do you set a jpg as a background in html?

i have tried, background="bgimg.jpg" , but it didn't work

20th Jan 2017, 8:11 AM
Jacobus van Wyk
Jacobus van Wyk - avatar
4 Answers
+ 4
When you use css to define background use background-image: url("bgimage.jpg") Do not use BACKGROUND for these purposes, because it overrides ALL background styles: color, offset, position etc
20th Jan 2017, 8:16 AM
WittyBit
WittyBit - avatar
+ 3
use body tag body { // styles here }
20th Jan 2017, 8:19 AM
WittyBit
WittyBit - avatar
0
were in css do i insert it?
20th Jan 2017, 8:18 AM
Jacobus van Wyk
Jacobus van Wyk - avatar
0
ok that helps a lot thanks
20th Jan 2017, 8:21 AM
Jacobus van Wyk
Jacobus van Wyk - avatar