HTML

HTML 文档第一行用 <!DOCTYPE html> 声明这是一个 HTML 文档

在 head 部分用 <meta charset="UTF-8"> 来解决中文乱码问题


常用格式化标签


属性是为 ​HTML​ 元素提供的附加信息,一般形式:name="value"

在某些个别的情况下,比如属性值本身就含有双引号,那么必须使用单引号,例如:name='John "ShotGun" Nelson'

HTML全局属性


HTML链接


HTML id


HTML head


HTML entity name(HTML 符号实体))即特殊符号的转义字符


图像

<img src="图片.jpg" alt="替代文本" width="304" height="228" border = "3" align="right">

其中,border 指定图像的边框宽度,border=0 时图片无边框。
在 HTML5 中已经废弃,可用 CSS 代替align 指定图片的对齐方式(center 居中,right 右侧)

同一个图片的不同区域对应不同链接

表格

基本结构

头部,主体和页脚的对应的三个标签是:

表格空间:

Pasted image 20240127122307.png|325

合并单元格

行合并:rowspan
列合并:colspan

<table border = "1">
<tr>
	<th>Column 1</th>
	<th>Column 2</th>
	<th>Column 3</th>
</tr>
<tr>
	<td rowspan = "2">Row 1 Cell 1</td>
	<td>Row 1 Cell 2</td>
	<td>Row 1 Cell 3</td>
</tr>
<tr>
	<td>Row 2 Cell 2</td>
	<td>Row 2 Cell 3</td>
</tr>
<tr>
	<td colspan = "3">Row 3 Cell 1</td>
</tr>
</table>

效果如下:(关注 Row1 Cell1Row3 Cell1

Pasted image 20240127175130.png|319

列表

无序列表

<ul>  
	<li>Coffee</li>
	<li>Milk</li>
</ul>

有序列表

<ol>       
	<li>Coffee</li>      
	<li>Milk</li>       
</ol>