预备:安装emmet插件(previously known as Zen Coding)
方法一 package control法:
上一篇博客已经介绍了如何安装package control。打开sublime,mac下用command + shift + p调出命令窗口,输入install,选中package control:install package,等待1-2秒,下拉选中emmet plugin回车,等待2-3秒,重启sublime。
方法二 手动安装法:
git下emmet plugin,打开sublime,preferences,browse packages,将下载的zip文件解压放到packages文件夹下,重启sublime。
参见:官方安装文档 用命令 command + F 查找 install即可。
删除已安装插件:按ctr+shift +p然后输入remove 回车,再输入要删除的插件名。
开始体验:输入以下简写,按tab键
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>