打开sublime,mac下用command + shift + p调出命令窗口,输入install,选中package control:install package,等待1-2秒,下拉选中emmet plugin回车,等待2-3秒,重启sublime。
开始体验:输入以下简写,按control+E键/ctrl+E
html:5
1 <!doctype html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 </head> 7 <body> 8 9 </body> 10 </html>
html:4t
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2 <html lang="en"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 5 <title>Document</title> 6 </head> 7 <body> 8 9 </body> 10 </html>
html:4s
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 2 <html lang="en"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 5 <title>Document</title> 6 </head> 7 <body> 8 9 </body> 10 </html>
html:xxs
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 5 <title>Document</title> 6 </head> 7 <body> 8 9 </body> 10 </html>
ul#nav>li.itemS*4>a{Item $}
1 <ul id="nav"> 2 <li class="itemS"><a href="">Item 1</a></li> 3 <li class="itemS"><a href="">Item 2</a></li> 4 <li class="itemS"><a href="">Item 3</a></li> 5 <li class="itemS"><a href="">Item 4</a></li> 6 </ul>
更多炫酷信息和emmet语法请参见: