Blogger Information
Blog 14
fans 0
comment 0
visits 23818
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
Emmet常用的8种语法形式
逍遥php
Original
579 people have browsed it

1.Emmet常用语法

1.1 标签与内容

  1. 语法:'{text}',.title{默认标签}
  2. <h3>html是结构化标签语言</h3>
  3. <div class="title">默认标签</div>

1.2 属性和语法糖

  1. 语法:'[attr]' ,[id=app]{app}
  2. <div id="app">app</div>
  3. <!-- id,class是高频,通用属性,emmet为它定制了“语法糖”
  4. 'id=>#,class=>.' -->
  5. <!-- #app1{app1},.app2{app2} -->
  6. <div id="app1">app1</div>
  7. <div class="app2">app2</div>

1.3 重复:’*’

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

1.4 父子:’>’

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

1.5 兄弟:’+’

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

1.6 父级:’^’

  1. <!-- .box>span{text}^h3{小标题} -->
  2. <div class="box"><span>text</span></div>
  3. <h3>小标题</h3>

1.7 分组:’(…)’

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

1.8 序号:’$’,’$@’

  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>

2.实战演习Emmet

  1. <!-- .test>(h3{我是Emmet,很高兴认识你}+ul.cotainer>li{我是$号}*3+li{我是$@4号}*3+li{我是倒序$@-1号}*3)^#test2{欢迎使用Emmet语法} -->
  2. <div class="test">
  3. <h3>我是Emmet,很高兴认识你</h3>
  4. <ul class="cotainer">
  5. <li>我是1号</li>
  6. <li>我是2号</li>
  7. <li>我是3号</li>
  8. <li>我是4号</li>
  9. <li>我是5号</li>
  10. <li>我是6号</li>
  11. <li>我是倒序3号</li>
  12. <li>我是倒序2号</li>
  13. <li>我是倒序1号</li>
  14. </ul>
  15. </div>
  16. <div id="test2">欢迎使用Emmet语法</div>
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