How do I set the bg image so that it stays the same while scrolling up and down without repeating? | Sololearn: Learn to code for FREE!

-1

How do I set the bg image so that it stays the same while scrolling up and down without repeating?

The background image is full-screen on th current page but when I scroll down, the image is in loop, although still full-screen, the background image just keeps on repeating while scrolling up and down. Already tried using background-repeat and background-attachment properties. But it won't work.

7/5/2022 3:38:30 PM

Meow Meow

10 Answers

New Answer

+3

Meow Meow it is not possible to see why your code did not work before. You did not provide your code. SomeAwesome provided a code. But it is not that helpful with out your code. Since we can not compare the two codes. So please whenever you have a code related question please provide your code sample.

+1

Could you share ur code?

+1

Oh sorry I didnt read properly… Did it really not work? Can you give us you code, so I can look for mistakes

+1

*UPD https://code.sololearn.com/W87S4yopR1vE/?ref=app

0

background-attachement: fixed ; That should work 👍

0

Actually the code is pretty simple, I just added the background image. Like, background-image:url("random.jpg"); And it was a pure coincidence that the image fit perfectly on the viewable screen. The only problem is that, when I scroll down, the image just repeats itself. But I want the image to remain the same on every page without getting scrolled, like the background just never changes even when I scroll up to down and bottom to top again.

0

SomeAwesome thank you for answering 😊♥️

0

SomeAwesome but Idk why it didn't work when I tried it at first.

0

Chris Coder alright 😊

0

Use background cover property