即使不应用CSS,所有CSS背景图像是否加载? [英] Do all CSS background images get loaded even if the CSS isn't applied?

查看:103
本文介绍了即使不应用CSS,所有CSS背景图像是否加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我担心我们网站首页的载入时间。



我的首页使用默认样式表,所有样式的整个网站。我有其他页面上的元素的背景图片引用(即未在首页上使用)。当用户访问网站的首页时,这些背景图片图片是否会被加载?



或者,只有直接加载的css背景图片


解决方案

图片不会加载,除非他们实际上在页面上使用;只要主页上加载的所有样式都可以 - 这实际上是一个相当好的东西。一旦这个单一的CSS文件在查看器的缓存中,它在那里,不必为后续页面下载。



其他人的帖子只是提醒我我的信息关闭firebug;浏览器以外的FF可能很好地下载那些未使用的BG图像,但我真的怀疑它。


I'm concerned about load times on home page of our site.

My home page uses a default stylesheet with ALL the styles for the whole site. I have background image references for elements on other pages (i.e. not used on the homepage). Do these background-image graphics get loaded anyways when a user visits the homepage of the site?

Or are the only css background image that get loaded are the ones that are directly used on that page?

解决方案

The images won't load unless they are actually used on the page; as far as all the styles being loaded on the home page goes -- this is actually a reasonably good thing. Once that single CSS file is in the viewer's cache, its there and doesn't have to be downloaded for subsequent pages.

Someone else's post just reminded me I'm basing my info off of firebug; browsers other then FF may very well download those unused BG images, but I really doubt it.

这篇关于即使不应用CSS,所有CSS背景图像是否加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆