他的html代码用了什么不常用的技术..
回复内容:
我们在编写代码的时候常常用了很多空格或者缩进,这样一眼就能看出大概写什么,比如html在最左端,head和body往右边缩进一点,if,div什么的相对与head或body也向右边缩进一点。这主要是为了给人看,但是多了这么多空格,可读性是增加了,可是页面的大小却大了。
如果压缩掉,原先10K的可能变成6K,那么就节省了4K,100个用户原先要下载1000K的,现在只要600K,流量就节省了400K,GOOGLE浏览量那么大,1000万用户呢?一亿用户呢?这样可以节约流量。
反正99%的人没事不会去看google的源码,可读性不重要,google内部是有带了空格的可读性好的版本,如果想改代码,改完了再压缩,才放上去。还有的看起来比较乱不是html也不是javascript等语言的,那么肯定就是加密过了的。跟乱码似的,但是浏览器还是能读出来
=== 下面内容更新于 2014-12-12 ===
Why does Google use inline JavaScript and CSS on its homepage?
这个同样也是为了节省请求次数,加快速度,节省流量。【Quora】 基本的道理,郑诚的回答已经很清楚了
对于想更深入了解的,可以参考一下雅虎的前端优化XX条(记得最开始看的时候还是14条,现在已经34条了,天……)
对于已经看过这些原则,早已了然于胸的,我再补点料。
google首页可能是有史以来pv最高的页面,其优化也比较极端,极端到以下两种做法我在别的网站从来没见到过(我没有详细考证google的其他页面是否也有这样的处理):
1. 在服务器端处理跨浏览器兼容,根据User-Agent返回不同的页面内容
对于跨浏览器兼容,传统的做法包括:用js判断浏览器类型做不同处理、使用css hack、浏览器私有标记/属性。总而言之,在浏览器端搞定兼容性。
但这并不是唯一的解决方案,更不是对用户最优的。如果能承受工作量,可以做到在服务器端处理,则兼容性相关的代码不必传给用户,可以节省相关的网络流量。而google首页就是这样做的。
可以给firefox装个ua switcher,一试便知。
我觉得,大多数网站,可能没有这种页面简单,而又pv巨巨高的页面来玩这套。但将工作量向服务器端转移,可以成为一种思路,比如jquery库中,很多代码在处理特定浏览器中的问题,那不妨分浏览器编译出若干版本,在体积和执行效率上都有优势。
2. 为减小页面体积,不惜违背规范
这个要只是属性不写双引号之类的,也就不拿出来说事了。
但你打开google首页,找不到

MicrodatainHTML5enhancesSEOanduserexperiencebyprovidingstructureddatatosearchengines.1)Useitemscope,itemtype,anditempropattributestomarkupcontentlikeproductsorevents.2)TestmicrodatawithtoolslikeGoogle'sStructuredDataTestingTool.3)ConsiderusingJSON-LD

HTML5introducesnewinputtypesthatenhanceuserexperience,simplifydevelopment,andimproveaccessibility.1)automaticallyvalidatesemailformat.2)optimizesformobilewithanumerickeypad.3)andsimplifydateandtimeinputs,reducingtheneedforcustomsolutions.

H5 is HTML5, the fifth version of HTML. HTML5 improves the expressiveness and interactivity of web pages, introduces new features such as semantic tags, multimedia support, offline storage and Canvas drawing, and promotes the development of Web technology.

Accessibility and compliance with network standards are essential to the website. 1) Accessibility ensures that all users have equal access to the website, 2) Network standards follow to improve accessibility and consistency of the website, 3) Accessibility requires the use of semantic HTML, keyboard navigation, color contrast and alternative text, 4) Following these principles is not only a moral and legal requirement, but also amplifying user base.

The H5 tag in HTML is a fifth-level title that is used to tag smaller titles or sub-titles. 1) The H5 tag helps refine content hierarchy and improve readability and SEO. 2) Combined with CSS, you can customize the style to enhance the visual effect. 3) Use H5 tags reasonably to avoid abuse and ensure the logical content structure.

The methods of building a website in HTML5 include: 1. Use semantic tags to define the web page structure, such as, , etc.; 2. Embed multimedia content, use and tags; 3. Apply advanced functions such as form verification and local storage. Through these steps, you can create a modern web page with clear structure and rich features.

A reasonable H5 code structure allows the page to stand out among a lot of content. 1) Use semantic labels such as, etc. to organize content to make the structure clear. 2) Control the rendering effect of pages on different devices through CSS layout such as Flexbox or Grid. 3) Implement responsive design to ensure that the page adapts to different screen sizes.

The main differences between HTML5 (H5) and older versions of HTML include: 1) H5 introduces semantic tags, 2) supports multimedia content, and 3) provides offline storage functions. H5 enhances the functionality and expressiveness of web pages through new tags and APIs, such as and tags, improving user experience and SEO effects, but need to pay attention to compatibility issues.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

WebStorm Mac version
Useful JavaScript development tools

Atom editor mac version download
The most popular open source editor

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
