将您的HTML,CSS和Javascript细化为一个坏主意?

将您的HTML,CSS和Javascript细化为一个坏主意?,第1张

概述维基百科 defines minification作为… […] the process of removing all unnecessary characters from source code without changing its functionality. These unnecessary characters usually include white space charac 维基百科 defines minification作为…

[…] the process of removing all unnecessary characters from source code without changing its functionality. These unnecessary characters usually include white space characters,new line characters,comments,and sometimes block delimiters,which are used to add readability to the code but are not required for it to execute.

为了节省带宽,我目前正在做这些工作,但有人告诉我,当某些标签(即ul和li项目)之间没有空格时,他会记得浏览器的行为不正确.这是真的?

在处理最小化的代码时,是否有任何值得注意的浏览器,代理或其他用户代理行为不当?

除了在查看源代码时丢失可读性,还有其他缺点吗?

解决方法

someone told me that he remembers a browser misbehaving when there’s
no white space between certain Tags (namely ul and li items). Is this
true?

是的,在某些情况下,就像元素被设置为显示内嵌块或内联一样.

以下两个列表将呈现不同的原因,因为< li>之间的空格内容:

HTML

<ul>    <li>simple</li>    <li>List</li></ul><ul><li>minifIEd</li><li>List</li></ul>

CSS

li {    display: inline-block;    background: blue;    color: white;}

渲染输出

http://jsfiddle.net/Uwv3e/

总结

以上是内存溢出为你收集整理的将您的HTML,CSS和Javascript细化为一个坏主意?全部内容,希望文章能够帮你解决将您的HTML,CSS和Javascript细化为一个坏主意?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1099220.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存