html分类代码查询,html标签元素分类(示例代码)
时间: 2024-04-30 19:21:47 浏览: 10
HTML标签元素可以分为以下几类:
1. 文本内容标签:用于展示文本内容,例如p、span、h1-h6等标签。
```html
<p>这是一个段落标签</p>
<span>这是一个行内标签</span>
<h1>这是一个标题标签</h1>
```
2. 列表标签:用于展示有序或无序列表,例如ul、ol、li等标签。
```html
<ul>
<li>第一项</li>
<li>第二项</li>
</ul>
<ol>
<li>第一项</li>
<li>第二项</li>
</ol>
```
3. 图片与媒体标签:用于展示图片和媒体内容,例如img、audio、video等标签。
```html
<img src="image.jpg" alt="图片描述">
<audio src="audio.mp3" controls></audio>
<video src="video.mp4" controls></video>
```
4. 链接标签:用于创建链接,例如a标签。
```html
<a href="https://www.baidu.com">百度</a>
```
5. 表格标签:用于展示表格,例如table、tr、th、td等标签。
```html
<table>
<thead>
<tr>
<th>姓名</th>
<th>年龄</th>
</tr>
</thead>
<tbody>
<tr>
<td>张三</td>
<td>20</td>
</tr>
<tr>
<td>李四</td>
<td>22</td>
</tr>
</tbody>
</table>
```
6. 表单标签:用于创建表单,例如form、input、label等标签。
```html
<form action="submit.php" method="post">
<label for="username">用户名:</label>
<input type="text" id="username" name="username">
<label for="password">密码:</label>
<input type="password" id="password" name="password">
<input type="submit" value="提交">
</form>
```
7. 其他标签:例如div、header、footer等标签,用于布局和组织页面结构。
```html
<header>
<h1>网站标题</h1>
<nav>
<ul>
<li><a href="#">导航1</a></li>
<li><a href="#">导航2</a></li>
</ul>
</nav>
</header>
<div class="content">
<p>这是一个内容区域</p>
</div>
<footer>
<p>版权所有 © 2021</p>
</footer>
```