Blogger Information
Blog 50
fans 0
comment 0
visits 31513
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
element常见语法实例演示
手机用户1580651468
Original
625 people have browsed it

element常见语法实例演示

Emmet是一个web开发工具,用于加快HTML和css代码的编写速度。

一、元素常见语法

  1. 初始化html结构操作就是 (生成html页面按!+键)

1.标签与内容

代码如下:
<!DOCTYPE html>

<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>

<body>
<!-- 1.标签与内容:`{text}` -->
<h3>html是结构化标签语言</h3>
<!-- .title{默认标签} 按下tab键-->
<div class="title">默认标签</div>
</body>
</html>

2.属性与语法糖

代码如下:
<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<!-- 2.属性和语法糖:`[attr]` -->
<!-- 语法糖:快捷方式,简单语法简单表示 -->
<!-- [id=app]{app} -->
<div id="app">app</div>
<!-- [class=title]{title} -->
<div class="title">title</div>
<!-- id,class是高频属性,通用属性,定义语法糖 -->
<!-- ‘id=#’,'class=.' -->
<!-- #app{app1} -->
<div id="app">app1</div>
<!-- .title{title1} -->
<div class="title">title1</div>
</body>
</html>

3.重复

代码如下:
<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<!-- 3.重复:`*` -->
<!-- .container{box}*3 -->
<div class="container">box</div>
<div class="container">box</div>
<div class="container">box</div>
</body>
</html>

4.父子

代码如下:
<!-- 4.父子:`>` -->
<!-- ul>li{item}*3 -->
<ul>
<li>item</li>
<li>item</li>
<li>item</li>
</ul>

5.兄弟

<!-- 5.兄弟:`+` h3{标题}+p{内容} -->

  1. <h3>标题</h3>
  2. <p>内容</p>

6.父级

  1. <!-- 6:父级.`^`
  2. .box>span{text}^h3{标题} -->
  3. <div class="box"><span>text</span></div>
  4. <h3>标题</h3>

7.分组

<!-- 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.序号

<!-- 8:序号:`$`,`$@` -->

  1. <!-- ul>li{item-$}*3 -->
  2. ul>li{item-$}*3
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