Html 如何使多页使用的图像只加载一次

Html 如何使多页使用的图像只加载一次,html,image,Html,Image,在我的网站上,我为每个页面使用相同的背景图像,如果可能的话,我只希望它下载给用户一次,这样就不必在每次点击时再次下载 我该怎么做 非主题:不要在html标签上使用背景图像!在车身上使用它 关于您的问题:因为您使用了子域,每次它都会从不同的url加载您的bg。无论如何,有一个解决方案,使用完整的url加载所有页面的背景图像像这样: html { background: url(http://www.trinity-international.com/tower3.jpg) no-repea

在我的网站上,我为每个页面使用相同的背景图像,如果可能的话,我只希望它下载给用户一次,这样就不必在每次点击时再次下载

我该怎么做


非主题:不要在
html
标签上使用
背景图像
!在
车身上使用它

关于您的问题:因为您使用了
子域
,每次它都会从不同的url加载您的bg。无论如何,有一个解决方案,使用完整的url加载所有页面的背景图像像这样:

html {
    background: url(http://www.trinity-international.com/tower3.jpg) no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}
但我建议使用以下方法:

body {
    background: url(http://www.trinity-international.com/tower3.jpg) no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

非主题:不要在
html
标签上使用
背景图像
!在
车身上使用它

关于您的问题:因为您使用了
子域
,每次它都会从不同的url加载您的bg。无论如何,有一个解决方案,使用完整的url加载所有页面的背景图像像这样:

html {
    background: url(http://www.trinity-international.com/tower3.jpg) no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}
但我建议使用以下方法:

body {
    background: url(http://www.trinity-international.com/tower3.jpg) no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

非常好用,谢谢!也会变为身体,初学者的错误!非常好用,谢谢!也会变为身体,初学者的错误!此图像应由浏览器缓存,不会在每次请求时下载。此图像应由浏览器缓存,不会在每次请求时下载。