How to fit the image in html? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to fit the image in html?

I want to fit an image in html document without repeating it continuosly when scrolling down or toward the right. I have tried many times but unable to fix it

11th Sep 2020, 12:29 PM
Ankit Meena
Ankit Meena - avatar
4 Answers
+ 6
height: 100vh; width: 100vw; background-attachment: fixed; background-size: cover; background-image:url(Enter URL of image here);
11th Sep 2020, 12:50 PM
ツSampriya😘ツ
ツSampriya😘ツ - avatar
+ 3
hi Ankit Meena if you dont mind showing your code for better understanding, you can use position:fixed; to make the image stay at a position and background-repeat:none;
11th Sep 2020, 12:43 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 2
Thanks
11th Sep 2020, 12:48 PM
Ankit Meena
Ankit Meena - avatar
+ 2
Thanks now the problem is fixed https://code.sololearn.com/W6B86x1r48wD/?ref=app
11th Sep 2020, 12:52 PM
Ankit Meena
Ankit Meena - avatar