body{background:url(image.jpg) 0 bottom}

 如果页面内容未超过一屏,会导致body的背景图片向内容的最低端对齐,而不是窗口

高度也只是取到了内容区的高度,但background却可以铺满整个窗口,很是怪异

原因不详

解决方案1:

将body改成html 

html{background:url(image.jpg) 0 bottom;min-height:100%}// min-height:不影响IE

解决方案2:

用js获取窗口的高度(document.documentElement.clientHeight)赋值给body的height 

相关文章:

  • 2021-10-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-14
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-01
  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
相关资源
相似解决方案