• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Resizable background-image in css body but avoid repeating

Resolved: Resizable background-image in css body but avoid repeating

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I am trying to add this image https://upload.wikimedia.org/wikipedia/commons/thumb/4/40/Coffee_and_Friends_(Unsplash).jpg/2560px-Coffee_and_Friends_(Unsplash).jpg as background-image for body selector.
Here’s my code
it’s working fine but at certain size image started to repeat so I added background-repeat: no-repeat; in code.
Now in place of repeated image there is white space in window, How to fill this white space with single image ?

Answer:

Just add the background-position and background-attachment properties:
  • background-position will set the starting position of your background image
  • background-attachment (set to fixed) will prevent your background image from scrolling with the content of your page



If you have better answer, please add a comment about this, thank you!

background-image css
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: I am facing ERR_HTTP2_PROTOCOL_ERROR on my website

27/03/2023

Resolved: TypeScript does not recognize properties when instantiating interface array

27/03/2023

Resolved: How to make statement case insensitive when uploading a dta file with specified columns?

27/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.