49 lines
1.0 KiB
Markdown
49 lines
1.0 KiB
Markdown
# 1. HTML
|
|
|
|
## 1.1 基本结构
|
|
```html
|
|
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>示例页面</title>
|
|
</head>
|
|
<body>
|
|
<h1>欢迎来到我的页面</h1>
|
|
<p>这是一个简单的 HTML 示例。</p>
|
|
</body>
|
|
</html>
|
|
```
|
|
|
|
## 1.2 常用标签
|
|
### 1.2.1 标题标签
|
|
```html
|
|
<h1>一级标题</h1>
|
|
<h2>二级标题</h2>
|
|
<h3>三级标题</h3>
|
|
```
|
|
### 1.2.2 段落标签
|
|
```html
|
|
<p>这是一个段落。</p>
|
|
```
|
|
### 1.2.3 链接标签
|
|
```html
|
|
<a href="https://www.example.com">访问示例网站</a>
|
|
```
|
|
### 1.2.4 图片标签
|
|
```html
|
|
<img src="image.jpg" alt="示例图片">
|
|
```
|
|
|
|
## 1.3 表单元素
|
|
```html
|
|
<form action="submit.php" method="post">
|
|
<label for="username">用户名:</label>
|
|
<input type="text" id="username" name="username">
|
|
<br>
|
|
<label for="password">密码:</label>
|
|
<input type="password" id="password" name="password">
|
|
<br>
|
|
<input type="submit" value="提交">
|
|
</form> |