维基百科
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; }
渲染输出