如果您查看波士顿环球报的源代码,您会发现一个链接将所有 CSS 一次性串在一起。
<link href="/css/html5reset.css,globe-globals.css,globe-masthead.css,globe-nav.css,globe-nav-menus.css,globe-saved.css,globe-main.css,globe-footer.css,globe-print.css" rel="stylesheet" media="only all">
我第一次见。我的问题
- 这是包含 CSS 的好方法吗?
- 它是否只进行一次 HTTP 调用? (来源在点击时将它们显示为一个 CSS 文件)。
最佳答案
you'll see that one single link strings together all the CSS in one go
没有。我们看到的是一个带有 URL 的文件,暗示它是通过将一堆文件连接在一起创建的。
Is this a good way of including CSS?
是的。拥有一个 CSS 文件意味着只有一个 HTTP 请求来获取它。
Does it makes just one HTTP call?
是的。
关于html - 堆叠 CSS 文件而不是组合它们 - 优点和缺点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8326663/