为什么这种css组织方法更好?

Sim*_*Suh 1 css organized

我工作站的高级开发人员编码如下:

table {border-collapse: collapse;border-spacing: 0;}
fieldset,img {border: 0;}
address,button,caption,cite,code,dfn,em,input,optgroup,option,select,strong,textarea,th,var {font:inherit;}
del,ins {text-decoration: none;}
li {list-style: none;}
caption,th {text-align: left;}
h1,h2,h3,h4,h5,h6 {font-size: 100%;font-weight: normal;}
q:before,q:after {content: '';}
abbr,acronym {border: 0;font-variant: normal;}
sup{vertical-align: baseline;}
sub{vertical-align: baseline;}
legend {color: #000;}
strong{font-weight:600;}
Run Code Online (Sandbox Code Playgroud)

我编写了相同的东西(在高级开发人员审核/重写我的代码之前,我工作过的相同css代码的不同部分):

html {
    background-color: #7e1d32;
    font: 16px/22px arial, sans-serif;
}
#outer_container {
    min-height: 598px;
    width: 100%;
    background: #D4D4D4 url('../images/top_bg.gif') repeat-x top left;
}
#inner_container {
    min-height: 698px;
    width: 100%;
    background: #D4D4D4 url('../images/top_designed_bg.jpg') repeat-x top center;
}

/* top orange banner */
#top_orange_bar {
    height: 47px;
    width: 100%;
    background: transparent url('../images/top_orange_bg.gif') repeat top left;
}
#top_orange_bar_content {
    width: 1026px;
    margin: 0 auto;
}
#top_orange_bar_content .left {
    float: left;
    width: 730px;
    margin-left: 40px;
}
#top_orange_bar_content .left h4 {
    text-transform: uppercase;
    letter-spacing: 1px;
    font: bold 14px/52px arial, sans-serif;
    color: #7f1e32;
}
#top_orange_bar_content .right {
    float: right;
    width: 160px;
    margin-right: 40px;
    text-align: right;
}
#top_orange_bar_content .right a {
    margin-top: 8px;
}
Run Code Online (Sandbox Code Playgroud)

以高级开发人员的方式编写css代码有什么好处?

Ita*_*vka 6

好吧,他不是那么高级......
他读到某个地方,额外的字符使页面加载速度慢,他是对的, 代码需要可维护和可读.
您应该按照自己的方式进行编码,并在将文件部署到生产环境使用缩小器来清理空白字符代码.通常这是构建/发布过程的一部分.
那将是高级开发人员所做的.

  • 它很有趣,你拼错了可读.但我确实同意他可能正试图缩小文档. (2认同)