Background | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Background

How do you keep a background image in html center to the window so if you resize the window the background image will resize with it?

17th Nov 2017, 2:46 AM
Kyle
2 Answers
+ 3
u can use background-position : center or margin of block container box is margin: 0px auto;
17th Nov 2017, 3:20 AM
Mukhtaar Aziz
Mukhtaar Aziz - avatar
+ 1
If there is a large sized image you could use image-size: contain; image-position: 50px 50px; Adjust the percentage values to find the best spot.
17th Nov 2017, 5:07 AM
Calviղ
Calviղ - avatar