admin管理员组

文章数量:1289866

Duplicate of:

Stretch and Scale CSS Background
How do I stretch a background image to cover the entire HTML element?
background image doesn’t stretch full page width

I've got a webpage background image, which needs to be displayed fully at 100% of the window's size. If the window is resized, the image needs to resize with it, to stay at 100%.

CSS does not allow you to set the sizes of the background image, only the way it repeats. (but I want it stretched)

I assume jQuery is the safest and quickest way of realizing this, to overe browser-inpatibleness. Or can this be done quickly with regular javascript?

Duplicate of:

Stretch and Scale CSS Background
How do I stretch a background image to cover the entire HTML element?
background image doesn’t stretch full page width

I've got a webpage background image, which needs to be displayed fully at 100% of the window's size. If the window is resized, the image needs to resize with it, to stay at 100%.

CSS does not allow you to set the sizes of the background image, only the way it repeats. (but I want it stretched)

I assume jQuery is the safest and quickest way of realizing this, to overe browser-inpatibleness. Or can this be done quickly with regular javascript?

Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked May 17, 2009 at 11:07 GerritGerrit 1,5995 gold badges16 silver badges23 bronze badges 2
  • alltough it's a duplicate, I like this question's accepted answer better than the ones from the earlier questions. – Gerrit Commented May 17, 2009 at 12:05
  • possible duplicate of How do I stretch a background image to cover the entire HTML element? – Qantas 94 Heavy Commented Jul 20, 2014 at 8:23
Add a ment  | 

1 Answer 1

Reset to default 8

This link might interest you:

How Do you Stretch a Background Image in a Web Page

本文标签: javascriptBackground image at 100 of window (and resizes with it)Stack Overflow