Emmet是一款编辑器插件,支持多种编辑器支持。在前端开发中,Emmet 使用缩写语法快速编写 HTML、CSS 以及实现其他的功能,极大的提高前端开发效率。
Child: >
- nav>ul>li
1 2 3 4 5 |
<nav> <ul> <li></li> </ul> </nav> |
Sibling: +
- div+p+bq
1 2 3 |
<div></div> <p></p> <blockquote></blockquote> |
Climb-up: ^
- div+div>p>span+em^bq
1 2 3 4 5 |
<div></div> <div> <p><span></span><em></em></p> <blockquote></blockquote> </div> |
- div+div>p>span+em^^bq
1 2 3 4 5 |
<div></div> <div> <p><span></span><em></em></p> </div> <blockquote></blockquote> |
Grouping: ()
- div>(header>ul>li*2>a)+footer>p
1 2 3 4 5 6 7 8 9 10 11 |
<div> <header> <ul> <li><a href=""></a></li> <li><a href=""></a></li> </ul> </header> <footer> <p></p> </footer> </div> |
- (div>dl>(dt+dd)*3)+footer>p
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<div> <dl> <dt></dt> <dd></dd> <dt></dt> <dd></dd> <dt></dt> <dd></dd> </dl> </div> <footer> <p></p> </footer> |
Multiplication: *
- ul>li*5
1 2 3 4 5 6 7 |
<ul> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> |
Item numbering: $
- ul>li.item$*5
1 2 3 4 5 6 7 |
<ul> <li class="item1"></li> <li class="item2"></li> <li class="item3"></li> <li class="item4"></li> <li class="item5"></li> </ul> |
- h[Math Processing Error]]{Header $}*3
1 2 3 |
<h1 title="item1">Header 1</h1> <h2 title="item2">Header 2</h2> <h3 title="item3">Header 3</h3> |
- ul>li.item$$$*5
1 2 3 4 5 6 7 |
<ul> <li class="item001"></li> <li class="item002"></li> <li class="item003"></li> <li class="item004"></li> <li class="item005"></li> </ul> |
- ul>li.item$@-*5
1 2 3 4 5 6 7 |
<ul> <li class="item5"></li> <li class="item4"></li> <li class="item3"></li> <li class="item2"></li> <li class="item1"></li> </ul> |
- ul>li.item$@3*5
1 2 3 4 5 6 7 |
<ul> <li class="item3"></li> <li class="item4"></li> <li class="item5"></li> <li class="item6"></li> <li class="item7"></li> </ul> |
ID and CLASS attributes
- #header
1 |
<span role="presentation"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">div</span> <span class="cm-attribute">id</span>=<span class="cm-string">"header"</span><span class="cm-tag cm-bracket">></</span><span class="cm-tag">div</span><span class="cm-tag cm-bracket">></span></span> |
- .title
1 |
<div class="title"></div> |
- form#search.wide
1 |
<<span class="pl-ent">form</span> <span class="pl-e">id</span>=<span class="pl-s"><span class="pl-pds">"</span>search<span class="pl-pds">"</span></span> <span class="pl-e">class</span>=<span class="pl-s"><span class="pl-pds">"</span>wide<span class="pl-pds">"</span></span>></<span class="pl-ent">form</span>> |
- p.class1.class2.class3
1 |
<<span class="pl-ent">p</span> <span class="pl-e">class</span>=<span class="pl-s"><span class="pl-pds">"</span>class1 class2 class3<span class="pl-pds">"</span></span>></<span class="pl-ent">p</span>> |
Custom attributes
- p[title="Hello world"]
1 |
<p title="Hello world"></p> |
- td[rowspan=2 colspan=3 title]
1 |
<td rowspan="2" colspan="3" title=""></td> |
- [a='value1' b="value2"]
1 |
<div a="value1" b="value2"></div> |
Text: {}
- a{Click me}
1 |
<a href="">Click me</a> |
- p>{Click }+a{here}+{ to continue}
1 |
<p>Click <a href="">here</a> to continue</p> |
Implicit tag names
- .class
1 |
<div class="class"></div> |
- em>.class
1 |
<em><span class="class"></span></em> |
- ul>.class
1 2 3 |
<ul> <li class="class"></li> </ul> |
- table>.row>.col
1 2 3 4 5 |
<table> <tr class="row"> <td class="col"></td> </tr> </table> |
github同步更新:https://github.com/mounui/Sunshine/blob/master/Cheat%20Sheet/Emmet-cheatsheet.md
我的微信
扫一扫加我微信