Blogger Information
Blog 11
fans 0
comment 0
visits 6925
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
Ement常用语法/元素四类属性及布局标签学习
**
Original
415 people have browsed it

Ement常用语法

  1. <!-- p.first -->
  2. <p class="first"></p>
  3. <!-- #last -->
  4. <p id="last"></p>
  5. <div class="title"></div>
  6. <!-- 内容用{} -->
  7. <!-- .title{大家晚上好} -->
  8. <div class="title">大家晚上好</div>
  9. <!-- 父子关系:> + -->
  10. <!-- div>p>a -->
  11. <div>
  12. <p><a href=""></a></p>
  13. </div>
  14. <!-- 兄弟关系:> + -->
  15. <!-- div+p -->
  16. <div></div>
  17. <p></p>
  18. <!-- ^:向上一级 -->
  19. <!-- div+p^a -->
  20. <div></div>
  21. <p></p>
  22. <a href=""></a>
  23. <!-- 重复:* -->
  24. <!-- ul>li*3>a{link} -->
  25. <ul>
  26. <li><a href="">link</a></li>
  27. <li><a href="">link</a></li>
  28. <li><a href="">link</a></li>
  29. </ul>
  30. <!-- 分组:() -->
  31. <!-- .cart>h2{购物车}+(ul>li*3>a{商品})+p{总计:3件} -->
  32. <div class="cart">
  33. <h2>购物车</h2>
  34. <ul>
  35. <li><a href="">商品</a></li>
  36. <li><a href="">商品</a></li>
  37. <li><a href="">商品</a></li>
  38. </ul>
  39. <p>总计:3件</p>
  40. </div>
  41. <!-- tag[属性] -->
  42. <!-- a[href="https://isidun.com"]{埃斯顿科技} -->
  43. <a href="https://isidun.com">埃斯顿科技</a>
  44. <!-- 序号 -->
  45. <!-- ul.list>li.item*5>a{item$} -->
  46. <ul class="list">
  47. <li class="item"><a href="">item1</a></li>
  48. <li class="item"><a href="">item2</a></li>
  49. <li class="item"><a href="">item3</a></li>
  50. <li class="item"><a href="">item4</a></li>
  51. <li class="item"><a href="">item5</a></li>
  52. </ul>
  53. <!-- ul.list>li.item*5>a{item$@-1} -->
  54. <ul class="list">
  55. <li class="item"><a href="">item5</a></li>
  56. <li class="item"><a href="">item4</a></li>
  57. <li class="item"><a href="">item3</a></li>
  58. <li class="item"><a href="">item2</a></li>
  59. <li class="item"><a href="">item1</a></li>
  60. </ul>
  61. <!-- ul.list>li.item*5>a{item$@5} -->
  62. <ul class="list">
  63. <li class="item"><a href="">item5</a></li>
  64. <li class="item"><a href="">item6</a></li>
  65. <li class="item"><a href="">item7</a></li>
  66. <li class="item"><a href="">item8</a></li>
  67. <li class="item"><a href="">item9</a></li>
  68. </ul>
  69. <table>
  70. <tr>
  71. <td>item1</td>
  72. <td>item2</td>
  73. <td>item3</td>
  74. <td>item4</td>
  75. <td>item5</td>
  76. <td>item6</td>
  77. <td>item7</td>
  78. <td>item8</td>
  79. <td>item9</td>
  80. <td>item10</td>
  81. </tr>
  82. <tr>
  83. <td>item1</td>
  84. <td>item2</td>
  85. <td>item3</td>
  86. <td>item4</td>
  87. <td>item5</td>
  88. <td>item6</td>
  89. <td>item7</td>
  90. <td>item8</td>
  91. <td>item9</td>
  92. <td>item10</td>
  93. </tr>
  94. <tr>
  95. <td>item1</td>
  96. <td>item2</td>
  97. <td>item3</td>
  98. <td>item4</td>
  99. <td>item5</td>
  100. <td>item6</td>
  101. <td>item7</td>
  102. <td>item8</td>
  103. <td>item9</td>
  104. <td>item10</td>
  105. </tr>
  106. <tr>
  107. <td>item1</td>
  108. <td>item2</td>
  109. <td>item3</td>
  110. <td>item4</td>
  111. <td>item5</td>
  112. <td>item6</td>
  113. <td>item7</td>
  114. <td>item8</td>
  115. <td>item9</td>
  116. <td>item10</td>
  117. </tr>
  118. <tr>
  119. <td>item1</td>
  120. <td>item2</td>
  121. <td>item3</td>
  122. <td>item4</td>
  123. <td>item5</td>
  124. <td>item6</td>
  125. <td>item7</td>
  126. <td>item8</td>
  127. <td>item9</td>
  128. <td>item10</td>
  129. </tr>
  130. </table>

元素四类属性

  1. <!-- 1. 通用属性 .class,#id,style -->
  2. <div class="top">top</div>
  3. <div id="header">header</div>
  4. <div style="color: red">style</div>
  5. <!-- 2. 预置属性 -->
  6. <a href="https://www.isidun.com">isidun.com</a>
  7. <img src="/images/1.jpg" alt="" />
  8. <link rel="stylesheet" href="" />
  9. <!-- 3. 事件属性onclick -->
  10. <button onclick="alert('提交成功')">确定</button>
  11. <div>
  12. <input
  13. type="text"
  14. oninput="this.nextElementSibling.textContent = this.value"
  15. />
  16. <p>实时显示输入的内容</p>
  17. </div>
  18. <!-- 4. 自定义属性 data- -->
  19. <div data-email="harvey@isidun.com">用户信息</div>
  20. <button
  21. onclick="this.nextElementSibling.textContent = this.previousElementSibling.dataset.email"
  22. >
  23. 获取用户邮箱
  24. </button>
  25. <p>这里显示用户邮箱</p>

布局标签

  1. <!-- 经典 -->
  2. <div class="header">header</div>
  3. <div class="main">main</div>
  4. <div class="footer">footer</div>
  5. <!-- html5 语义化的布局标签 -->
  6. <header>header</header>
  7. <nav>nav</nav>
  8. <main>main</main>
  9. <article>article</article>
  10. <footer>footer</footer>

DIV+Class与 HTML5语义化标签的比较

HTML5语义化标签优势

  • 代码结构清晰
  • 对搜索引擎更友好,利于SEO
  • 项目维护起来会更容易

HTML5语义化标签缺点

  • 语义化标签数量有限,实际使用过程中还需要借助div+css辅助布局
  • 移动应用趋势,弱化了对搜引擎的SEO需求

DIV+CSS优势

  • 标签可以按需自由命名

DIV+CSS缺点

  • 网页结构不够清晰
  • 对跨团队协作对于规范开发有较高要求(可读性相对较差)
Correcting teacher:autoloadautoload

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