当前位置:实例文章 » HTML/CSS实例» [文章]HTML 速查列表

HTML 速查列表

发布人:shili8 发布时间:2025-02-16 19:35 阅读次数:0

**HTML速查列表**

HTML(HyperText Markup Language)是一种用来描述网页内容的标记语言。它是构建Web页面的基础,几乎所有的Web开发都离不开HTML。

### 基础知识#### HTML文档结构

html<!DOCTYPE html>
<html lang="zh-CN">
<head>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <title>Document</title>
</head>
<body>
</body>
</html>


* ``:声明文档类型* ``:定义HTML文档的语言* ``:包含元信息,如字符编码、viewport等* `Document`:定义网页标题#### HTML元素
html<!-- 元素 -->
<h1>Hello, World!</h1>
<p>This is a paragraph.</p>

<!-- 属性 -->
<img src="image.jpg" alt="An image">
<a href=" example.com</a>

<!-- 内容 -->
<div>
 <span>Some text</span>
</div>


* `

Hello, World!

`:定义一级标题* `

This is a paragraph.

`:定义一个段落* `An image`:定义一个图片元素,src属性指向图片的路径,alt属性为图片设置替代文本* `html<table> <tr> <th>Column1</th> <th>Column2</th> </tr> <tr> <td>Cell1</td> <td>Cell2</td> </tr> </table>

* ``:定义表格* ``:定义行* `
`:定义表头单元格* ``:定义表格单元格#### 表格属性| 属性名称 | 描述 |
| --- | --- |
| `border` | 为表格设置边框 |
| `cellpadding` | 为表格单元格设置内边距 |
| `cellspacing` | 为表格单元格设置外边距 |

### HTML 表单#### 定义表单
html<form>
 <label for="username">Username:</label>
 <input type="text" id="username" name="username">
 

 <label for="password">Password:</label>
 <input type="password" id="password" name="password">
 

 <button type="submit">Submit</button>
</form>


* `
`:定义表单* `