Blogger Information
Blog 5
fans 0
comment 0
visits 2423
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
Emmet常用的九种语法形式
P粉123761497
Original
741 people have browsed it

Emmet常用的八种语法形式

1. !+tab:快速生成html5源码模板

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. </head>
  9. <body>
  10. </body>
  11. </html>

2. 标签与内容 {text}

  1. <!--h3{title}-->
  2. <h3>title</h3>

3. 属性和“语法糖”:[attr]

  1. <!--[id=app]{app1}-->
  2. <div id="app">app1</div>
  3. <!--[class=title]{title}-->
  4. <div class="title">title</div>

id,class是高频通用属性,Emmet为他们定制了“语法糖”
id->#,class->.

  1. <!--#app{app1}-->
  2. <div id = "app">
  3. app1
  4. </div>
  5. <!--.title{title}-->
  6. <div class = "title">
  7. title
  8. </div>

4. 重复:*

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

5. 父子:>

  1. <!--ul>li{item}*3-->
  2. <ul>
  3. <li>item</li>
  4. <li>item</li>
  5. <li>item</li>
  6. </ul>

6. 兄弟:+

  1. <!--h3{标题}+p{段落}-->
  2. <h3>标题</h3>
  3. <p>段落</p>

7. 回到上一级(父级):^

  1. <!--.box>span{text}^h3{666}-->
  2. <div class="box">
  3. <span>text</span>
  4. </div>
  5. <h3>666</h3>

8. 分组(…)

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

9. 序号:$,$@

  1. <!--默认从1开始: ul>li{item-$}*3 -->
  2. <ul>
  3. <li>item-1</li>
  4. <li>item-2</li>
  5. <li>item-3</li>
  6. </ul>
  7. <!--自定义起始序号: ul>li{item-$@6}*3 -->
  8. <ul>
  9. <li>item-6</li>
  10. <li>item-7</li>
  11. <li>item-8</li>
  12. </ul>
  13. <!--逆序: ul>li{item-$@-1}*3 -->
  14. <ul>
  15. <li>item-3</li>
  16. <li>item-2</li>
  17. <li>item-1</li>
  18. </ul>
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