How to make the background image to fit into the whole page without repeating using plain css?

前端 未结 6 467
温柔的废话
温柔的废话 2021-02-01 06:28

I have an JPG image with size 1024 x 724. My page size is not fixed. My requirement is: If I resize the page then the background image should also resize and fit to the page.

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-01 06:49

    Depending on what kind of image you have, it might be better to rework the design so that the main image fades to a set solid color or repeatable pattern. If you center the image in the page and have the solid color as the backgroud.

    See http://www.webdesignerwall.com/trends/80-large-background-websites/ for examples of sites using large or scalable backgrounds.

提交回复
热议问题