wil*_*des 18 html coding-style multiline
我有一些冗长的HTML,超过我的项目的80个字符限制.我们有一个样式指南,它限制每行的字符数,这很好,因为现在该行运行的时间太长,以至于如果不向右滚动就无法看到它.
<div id="email-signup-container">
<div id="mc_embed_signup">
<div class="interested">
<div class="container">
<div class="left col-lg-6 col-md-6 col-sm-12 col-xs-12">
<h3>Help New York residents keep the heat on this winter.</h3>
<a href="http://www.nycharities.org/donate/charitydonate.asp?ID=4081" class="donate-btn btn-interest">DONATE</a>
</div>
<div class="right col-lg-6 col-md-6 col-sm-12 col-xs-12">
<h3>Without heat? Visit our resources page.</h3>
<a class="btn-interest" href="resources">RESOURCES</a>
</div>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
不幸的是,我找不到任何涵盖多行HTML的样式指南.我参与了一个项目,我们根据属性对项目进行了新的设计,但这是有争议的:
<a
href="http://www.nycharities.org/donate/charitydonate.asp?ID=4081"
class="donate-btn btn-interest">DONATE</a>
Run Code Online (Sandbox Code Playgroud)
有些人想要在这样的新线上关闭carot:
<a
href="http://www.nycharities.org/donate/charitydonate.asp?ID=4081"
class="donate-btn btn-interest"
>DONATE</a>
Run Code Online (Sandbox Code Playgroud)
其他人希望结束标记与开始标记处于同一级别:
<a
href="http://www.nycharities.org/donate/charitydonate.asp?ID=4081"
class="donate-btn btn-interest"
>
DONATE
</a>
Run Code Online (Sandbox Code Playgroud)
我讨厌所有人.任何人都可以指出任何已发布的风格指南,以便我们可以采用一个并继续前进吗?
我也一直想知道这个问题。我唯一能找到的是GoCardless 的指南,其中写道:
\n\n<!-- Try using line-breaks for multiple attributes, keeping the first attribute\non the tag\'s opening line -->\n\nGood:\n\n<div custom-attribute \nclass="something" \nrole="something-else"></div> \n<!-- The closing tag ^^^ can stay on the same line for empty elements-->\n\n<div custom-attribute \nclass="something" \nrole="something-else">\n\xc2\xb7\xc2\xb7Foo <!-- Otherwise nest plz -->\n</div> \nRun Code Online (Sandbox Code Playgroud)\n