Home >Web Front-end >HTML Tutorial >Detailed explanation of the use of Sublime Text plug-in Emmet
Installation Please read the previous article Sublime Text-Installation, use it with sublime’s own shortcut keys, and write HTML quickly.
The following are commonly used. For complete information, please see the emmet official documentation.
##! or
html:5, Quickly generate
HTML5 structure (you need to press the tab key again)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> </body> </html>
html:xt Generate HTML4 transitional type
html:4s Generate HTML4 strict type
p#header
<p id="header"></p>3. Generate elements with
p.title
<p class="title"></p>4. Generate descendant elements:> Such as:
nav>ul>li
<nav> <ul> <li></li> </ul> </nav>5 .Generate sibling elements: + such as:
p+p+p
<p></p> <p></p> <p></p>6. Generate superior elements: ^such as:
p^p
<p></p> <p></p>7. Repeatedly generate multiple elements: *
<ul> <li></li> <li></li> <li></li> <li></li> <li></li> </ul>
p[value=1]
<p value="1"></p>9. Generate text content: {}For example:
a{Click me}
<a href="">Click me</a>10. Add number: $
p.item${$$}*3
<p class="item1">01</p> <p class="item2">02</p> <p class="item3">03</p>
p.item$@-{$$@-}*3
<p class="item3">03</p> <p class="item2">02</p> <p class="item1">01</p>
p.item$@4{$$@4}*3
<p class="item4">04</p> <p class="item5">05</p> <p class="item6">06</p>11.
(ul>ol)*3
<ul> <ol></ol> </ul> <ul> <ol></ol> </ul> <ul> <ol></ol> </ul>Let’s take a
table#tab[value=1].a>tr*3>(td{$$}>span)*3
<table id="tab" value="1" class="a"> <tr> <td>01<span></span></td> <td>02<span></span></td> <td>03<span></span></td> </tr> <tr> <td>01<span></span></td> <td>02<span></span></td> <td>03<span></span></td> </tr> <tr> <td>01<span></span></td> <td>02<span></span></td> <td>03<span></span></td> </tr> </table>Generate cssMany css styles , there are naturally many abbreviations, just list the commonly used ones and draw inferences. The css abbreviation is matched using fuzzy search, such as ov:h == ov-h == ovh == oh.
width<a href="http://www.php.cn/wiki/835.html" target="_blank">: 10px;</a> w10p
width: 10%; w10e
width: 10em; w10x
width: 10xe;
height<a href="http://www.php.cn/wiki/836.html" target="_blank">: 10px;</a>
position<a href="http://www.php.cn/wiki/902.html" target="_blank">: relative;</a> poa
position: absolute;
float<a href="http://www.php.cn/wiki/919.html" target="_blank">: left;</a> fr
float: right<a href="http://www.php.cn/wiki/905.html" target="_blank">;</a>
display<a href="http://www.php.cn/wiki/927.html" target="_blank">: table;</a> db
display: block; dib
display: inline-block;
overflow-y: hidden;<a href="http://www.php.cn/wiki/926.html" target="_blank"></a>
clear: both;<a href="http://www.php.cn/wiki/917.html" target="_blank"></a>
: ; mb <a href="http://www.php.cn/wiki/933.html" target="_blank"></a>margin-bottom
: ;<a href="http://www.php.cn/wiki/935.html" target="_blank"></a>
pt <a href="http://www.php.cn/wiki/949.html" target="_blank">padding-top</a>: ;
pb <a href="http://www.php.cn/wiki/951.html" target="_blank">padding-bottom</a>: ;
tac <a href="http://www.php.cn/wiki/870.html" target="_blank">text-align</a>: center;
lh <a href="http://www.php.cn/wiki/864.html" target="_blank">line-height</a>:;
tsn <a href="http://www.php.cn/wiki/861.html" target="_blank">text-shadow</a>: none;
tja <a href="http://www.php.cn/wiki/881.html" target="_blank">text-justify</a>: auto;
c color: #000;
cr color: rgb(0, 0, 0);
cra color: rgba(0, 0, 0, .5);
op opacity: ;
cnt content: '';
ol <a href="http://www.php.cn/wiki/938.html" target="_blank">outline</a>: ;
bd+ border: 1px solid #000;
bdb+ border-bottom: 1px solid #000;
bd2px#333s border: 2px #333 solid;
如果没作用请检查快捷键是否冲突
快速生成包裹标签:Ctrl+Shift+G
只有文本没有结构时,如下
首页 简介 动态
选中文本按快捷键Ctrl+Shift+G,再弹出的:Enter Wrap Abbreviation(输入扩展缩写)中输入nav>ul>li.item$*>a
就会生成
<nav> <ul> <li class="item1"><a href="">首页</a></li> <li class="item2"><a href="">简介</a></li> <li class="item3"><a href="">动态</a></li> </ul> </nav>
如果原先的文本带编号,不想要则可以在上面的基础上加|t
,nav>ul>li.item$*>a|t
即可生成如上结果。
1首页 2简介 3动态
自动添加/更新图片尺寸:ctrl+U
光标移到标签上的任意位置,按下快捷键ctrl+U
即可。
<img src="img/x1.png" /> <img src="img/x1.png" width="100" height="200" />
删除标签:shift+ctrl+;
定位到上个编辑点:ctrl+alt+left
定位到下个编辑点:ctrl+alt+right
选中下一项:shift+ctrl+.
加/减1:ctrl+up/ctrl+down
加/减10:shift+alt+up/shift+alt+down
展开缩写:ctrl+e(和tab键作用相同)
重命名标签(rename_tag):ctrl+shift+'
更换标签(update_as_you_type):ctrl+Shift+U
匹配标签对:ctrl+alt+j
输入lorem
再按tab会随机生成一段英文,默认是生成30个单词,可以加上数字控制单词数量,如lorem5
。
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis incidunt, expedita voluptates ratione praesentium error a accusamus corporis deleniti. Cum, debitis id, in rem exercitationem at voluptatum illum minima corporis!
Lorem ipsum dolor sit amet.
The above is the detailed content of Detailed explanation of the use of Sublime Text plug-in Emmet. For more information, please follow other related articles on the PHP Chinese website!