省略html的可选标签 [英] Omitting optional tags of html

查看:91
本文介绍了省略html的可选标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚阅读了Google的这篇文章。我一直认为结束标记对于保持html文档清洁并使其机器可读是非常重要的。但他们建议相反。



您对此有何看法? Google处于一种不寻常的状况,因为他们提供了非常多的主要搜索页面副本,以至于页面大小的任何微小节省很快就会累积起来。这意味着对他们来说,通过删除封闭标签和空白来缩小他们的页面是很经济的,但这样做的代价是难以维护。它不太可能为你付出代价。您会注意到,您链接到自己的Google页面并没有忽略它推荐的标签,因为它不是Google服务很多关键页面之一。与www.google.com首页的极端缩小比较。



使用gzip / deflate压缩功能,您将获得最小的转换大小;进一步减少标记是绝望的措施,除非你服务的负载将是一个不成熟的优化。


I just read this article from Google. I always thought that closing tags is important to keep html documents clean and make them machine-readable. But they recommend the opposite.

What do you think about this?

解决方案

Google are in a somewhat unusual situation in that they serve so very many copies of their main search pages that any tiny saving in page size soon add up. This means for them it's economical to make their pages smaller by removing close tags and whitespace, at the cost of making them harder to maintain.

You aren't Google; it's unlikely to pay off for you. You'll notice the Google page you link to itself doesn't omit the tags it recommends, because it's not one of the critical pages that Google serves a lot of. Compare that to the extreme minification of www.google.com front page.

Use gzip/deflate compression and you'll already get mostly minimal transfer size; reducing markup further is a desperate measure which unless you're serving loads will be a premature optimisation.

这篇关于省略html的可选标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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