Blogger Information
Blog 26
fans 0
comment 0
visits 12189
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
emmet语法总结
高空中的云
Original
435 people have browsed it

emmet 语法

1. 标签与内容

标签名称{text},如:

  • {text},默认生成div块
    <div>text</div>
  • h3{h3title}
    <h3>h3title</h3>

2. 属性和语法糖[attr]

  • .classname{标签内容}, 如 title{div标签文本内容}
    <div class="title">div标签文本内容</div>
  • [id=idname]{标签内容}
    <div id="idname">标签内容</div>
  • [class=classname]{标签内容}
    <div class="classname">标签内容</div>
  • 因为id和class是高频通用属性,emmet定制了“语法糖”:id=>#,class=>.
    — #idname{标签内容}
    <div id="idname">标签内容</div>
    — .classname{标签内容}
    <div class="classname">标签内容</div>

3. 重复生成 *

  • .container{box}*3
    1. <div class="container">box</div>
    2. <div class="container">box</div>
    3. <div class="container">box</div>

4. 父子: >

  • ul.ulst#ulst>li.liitem{listtext}*3
    1. <ul class="ulst" id="ulst">
    2. <li class="liitem">listtext</li>
    3. <li class="liitem">listtext</li>
    4. <li class="liitem">listtext</li>
    5. </ul>

5. 兄弟: +

  • h3{h3标题}+h5{h5标题}
    1. <h3>h3标题</h3>
    2. <h5>h5标题</h5>

6. 父级 ^

  • .box>span{text}^h3{h3小标题}
    1. <div class="box">
    2. <span>text</span>
    3. </div>
    4. <h3>h3小标题</h3>
  • .container>.box>span{text}^^h3{顶层h3小标题}
    1. <div class="container">
    2. <div class="box"><span>text</span></div>
    3. </div>
    4. <h3>顶层h3小标题</h3>

7. 分组 (...)

  • nav>h3{导航}+(ul>li*3>a{link})
    1. <nav>
    2. <h3>导航</h3>
    3. <ul>
    4. <li><a href="">link</a></li>
    5. <li><a href="">link</a></li>
    6. <li><a href="">link</a></li>
    7. </ul>
    8. </nav>

8. 序号 $,$@

  • 默认从1开始 ul>li{item-$}*3
    1. <ul>
    2. <li>item-1</li>
    3. <li>item-2</li>
    4. <li>item-3</li>
    5. </ul>
  • 自定义从6开始 ul>li{item-$@6}*3
    1. <ul>
    2. <li>item-6</li>
    3. <li>item-7</li>
    4. <li>item-8</li>
    5. </ul>
  • 逆序 ul>li{item-$@-1}*3
    1. <ul>
    2. <li>item-3</li>
    3. <li>item-2</li>
    4. <li>item-1</li>
    5. </ul>
  • 逆序 ul>li{item-$@-5}*3
    1. <ul>
    2. <li>item-7</li>
    3. <li>item-6</li>
    4. <li>item-5</li>
    5. </ul>
  • $序号扩展之 h$[title=item$]{Header $}*3
    1. <h1 title="item1">Header 1</h1>
    2. <h2 title="item2">Header 2</h2>
    3. <h3 title="item3">Header 3</h3>
  • $序号扩展之 ul>li.item$$$*5
    1. <ul>
    2. <li class="item001"></li>
    3. <li class="item002"></li>
    4. <li class="item003"></li>
    5. <li class="item004"></li>
    6. <li class="item005"></li>
    7. </ul>

    9. 其他之包装文本

    选中多行文本,按下Ctrl + Shift + P 打开命令窗口
    输入 ewrap
    选择 Emmet: 使用缩写进行包装 选项
    输入缩写字符,如 ul>li* 按下回车键,将文本包装为一个无序列表
    包装文本样例
Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post