css宽度100%只覆盖屏幕大小(滚动后不覆盖线)

时间:2021-08-07 20:05:25

on my css code I set the background-image:url with

在我的css代码上我设置了background-image:url

height:100%;

but as a result, the range that the 100% capture is only the size of the screen. if the page have a scroll, all the page line needed to be scroll doesn't appear to have those background.

但结果是,100%捕获的范围只是屏幕的大小。如果页面有滚动,则需要滚动的所有页面行似乎都没有这些背景。

Any suggestions?

有什么建议么?

NOTE: my element size changes dynamically.

注意:我的元素大小动态变化。

2 个解决方案

#1


0  

body
{
background-image:url('paper.gif');
background-repeat:repeat-y;
} 

#2


0  

This is, because 100% means 100% of your parent element. First of all, make sure your document is actually 100% of your browser window.

这是因为100%表示100%的父元素。首先,确保您的文档实际上是浏览器窗口的100%。

html, body {
    width: 100%;
    height: auto !important;
    height: 100%; /* for older browsers */
    min-height: 100%;
}

#1


0  

body
{
background-image:url('paper.gif');
background-repeat:repeat-y;
} 

#2


0  

This is, because 100% means 100% of your parent element. First of all, make sure your document is actually 100% of your browser window.

这是因为100%表示100%的父元素。首先,确保您的文档实际上是浏览器窗口的100%。

html, body {
    width: 100%;
    height: auto !important;
    height: 100%; /* for older browsers */
    min-height: 100%;
}