文章目录
- 入门
- HTML5 标签
- HTML 表格
- Table 示例
- HTML表格标签
- \
属性 - \
属性 - HTML 列表
- HTML 表单
- HTML input 标签
- HTML meta 标签总结
- 标签语义化
- 另见
此 HTML 快速参考备忘单以可读布局列出了
HTML
和HTML5
标记。入门
hello.html
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>HTML5 Boilerplatetitle> head> <body> <h1>Hello world, hello 备忘清单!h1> body> html>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
或者在 jsfiddle
注释 Comment
- 1
- 2
- 3
- 4
- 5
- 6
段落 Paragraph
<p>我来自快速参考p> <p>分享快速参考备忘单。p>
- 1
- 2
请参阅:段落元素
HTML 链接
<a href="https://github.com/jaywcjlove/reference"> Github a> <a href="mailto:[email protected]">邮箱a> <a href="tel:+123456789">电话a> <a href="sms:+123456789&body=ha%20ha"> 短信 a>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
:- :- href
超链接指向的 URL rel
链接 URL 的关系 target
链接目标位置: _self
/_blank
/_top
/_parent
请参阅: 属性
Image 标签
<img loading="lazy" src="https://xxx.png" alt="在此处描述图像" width="400" height="400">
- 1
- 2
- 3
- 4
src
(URL/路径)必填,图片位置 alt
描述图像 width
图像宽度 height
图像高度 loading
浏览器应该如何加载 请参阅:图像嵌入元素
文本格式标签
<b>粗体文字b> <strong>这段文字很重要strong> <i>斜体文本i> <em>这段文字被强调em> <u>下划线文本u> <pre>预格式化文本pre> <code>源代码code> <del>删除的文字del> <mark>突出显示的文本 (HTML5)mark> <ins>插入的文本ins> <sup>使文本上标sup> <sub>使文本下标sub> <small>使文本变小small> <pre>预格式化文本pre> <kbd>Ctrlkbd> <blockquote>文本块引用blockquote>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
标题
<h1> 这是标题 1 h1> <h2> 这是标题 2 h2> <h3> 这是标题 3 h3> <h4> 这是标题 4 h4> <h5> 这是标题 5 h5> <h6> 这是标题 6 h6>
- 1
- 2
- 3
- 4
- 5
- 6
您的页面上应该只有一个
h1
Section Divisions
:- :- 页面内容的划分或部分 其他内容中的文本部分 文本段落 换行 水平分割线 这些标签用于将页面划分为多个部分
内部框架
<iframe id="inlineFrameExample" title="Inline Frame Example" width="100%" height="200" frameborder="0" src="https://www.openstreetmap.org/export/embed.html?bbox=-0.004017949104309083%2C51.47612752641776%2C0.00030577182769775396%2C51.478569861898606&layer=mapnik"> iframe>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
预览
请参阅:内联框架元素
HTML 中的 JavaScript
<script type="text/javascript"> let text = "Hello 快速参考"; alert(text); script>
- 1
- 2
- 3
- 4
外部 JavaScript
<body> ... <script src="app.js">script> body>
- 1
- 2
- 3
- 4
HTML 中的 CSS
<style type="text/css"> h1 { color: purple; } style>
- 1
- 2
- 3
- 4
- 5
外部样式表
<head> ... <link rel="stylesheet" href="style.css"/> head>
- 1
- 2
- 3
- 4
HTML5 标签
页面
<body> <header> <nav>...nav> header> <main> <h1>快速参考h1> main> <footer> <p>©2023 快速参考p> footer> body>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
标题导航
<header> <nav> <ul> <li><a href="#">编辑页面a>li> <li><a href="#">Twittera>li> <li><a href="#">Facebooka>li> ul> nav> header>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
HTML5 Tags
:- :- article 独立的内容 aside 次要内容 audio 嵌入声音或音频流 bdi 双向隔离元件 canvas 通过JavaScript绘制图形 data 机器可读内容 datalist 一组预定义选项 details 其他信息 dialog 对话框或子窗口 embed 嵌入外部应用程序 figcaption 图形的标题或图例 figure 插图 footer 页脚或最不重要的 header 刊头或重要信息 main 文件的主要内容 mark 突出显示的文本 meter 已知范围内的标量值 nav 导航链接的一部分 output 计算的结果 picture 用于多个图像源的容器 progress 任务的完成进度 rp 提供回退括号 rt 定义字符的发音 ruby 表示ruby注释 section 一系列相关内容中的组 source 媒体元素的资源 summary 元素的摘要 template 定义HTML片段 time 时间或日期 track 媒体元素的字幕信息 video 嵌入视频 wbr 换行机会 HTML5 Video
<video controls="" width="100%"> <source src="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4" type="video/mp4"> 很抱歉,您的浏览器不支持嵌入式视频。 video>
- 1
- 2
- 3
- 4
预览
很抱歉,您的浏览器不支持嵌入式视频。HTML5 Audio
<audio controls src="https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3"> 您的浏览器不支持音频元素。 audio>
- 1
- 2
- 3
- 4
- 5
预览
您的浏览器不支持音频元素。
HTML5 Ruby
<ruby> 汉 <rp>(rp><rt>hànrt><rp>)rp> 字 <rp>(rp><rt>zìrt><rp>)rp> 拼 <rp>(rp><rt>pīnrt><rp>)rp> 音 <rp>(rp><rt>yīnrt><rp>)rp> ruby>
- 1
- 2
- 3
- 4
- 5
- 6
↓ 预览
汉 字 拼 音HTML5 kdi
<ul> <li>User <bdi>hrefsbdi>: 60 pointsli> <li>User <bdi>jdoebdi>: 80 pointsli> <li>User <bdi>إيانbdi>: 90 pointsli> ul>
- 1
- 2
- 3
- 4
- 5
预览
- User hrefs: 60 points
- User jdoe: 80 points
- User إيان: 90 points
HTML5 progress
<progress value="50" max="100">progress>
- 1
HTML5 mark
<p>我爱<mark>备忘清单mark>p>
- 1
我爱备忘清单
HTML 表格
Table 示例
<table> <thead> <tr> <td>nametd> <td>agetd> tr> thead> <tbody> <tr> <td>Robertatd> <td>39td> tr> <tr> <td>Olivertd> <td>25td> tr> tbody> table>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
HTML表格标签
标签 说明 定义表格 定义表格中的标题单元格 定义表中的行 定义表格中的单元格 定义表格标题 定义一组列 定义表中的列 对标题内容进行分组 将正文内容分组 对页脚内容进行分组 属性 属性 说明 colspan
单元格应跨越的列数 headers
单元格与一个或多个标题单元格相关 rowspan
单元格应跨越的行数 请参阅:td#属性
属性 属性 说明 colspan
单元格应跨越的列数 headers
单元格与一个或多个标题单元格相关 rowspan
单元格应跨越的行数 abbr
单元格内容的描述 scope 表头元素(在 中定义)关联的单元格 请参阅:th#属性
HTML 列表
无序列表
<ul> <li>I'm an itemli> <li>I'm another itemli> <li>I'm another itemli> ul>
- 1
- 2
- 3
- 4
- 5
请参阅:无序列表元素
有序列表
<ol> <li>I'm the first itemli> <li>I'm the second itemli> <li>I'm the third itemli> ol>
- 1
- 2
- 3
- 4
- 5
请参阅:有序列表元素
定义列表
<dl> <dt>A Termdt> <dd>Definition of a termdd> <dt>Another Termdt> <dd>Definition of another termdd> dl>
- 1
- 2
- 3
- 4
- 5
- 6
请参阅:描述列表元素
HTML 表单
Form 标签
<form method="POST" action="api/login"> <label for="mail">邮箱: label> <input type="email" id="mail" name="mail"> <br/> <label for="pw">密码:label> <input type="password" id="pw" name="pw"> <br/> <input type="submit" value="登录"> <br/> <input type="checkbox" id="ck" name="ck"> <label for="ck">记住我label> form>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
预览
HTML
元素用于收集信息并将其发送到外部源。
Form 属性
属性 说明 name
脚本形式的名称 action
表单脚本的URL method
HTTP方法, POST
/GET
(默认)enctype
介质类型,请参见enctype onsubmit
提交表单时运行 onreset
在窗体重置时运行 Label 标签
<label>Click me <input type="text" id="user" name="name"/> label>
- 1
- 2
- 3
- 4
<label for="user">Click melabel> <input id="user" type="text" name="name"/>
- 1
- 2
- 3
for
在标签中引用输入的id
属性Input 标签
<label for="Name">Name:label> <input type="text" name="Name" id="">
- 1
- 2
预览
请参阅:HTML输入标记
Textarea 标签
<textarea rows="2" cols="30" name="address" id="address">textarea>
- 1
预览
Textarea 是一个多行文本输入控件
Radio Buttons
<input type="radio" name="gender" id="m"> <label for="m">Malelabel> <input type="radio" name="gender" id="f"> <label for="f">Femalelabel>
- 1
- 2
- 3
- 4
预览
单选按钮用于让用户只选择一个
Checkboxes
<input type="checkbox" name="s" id="soc"> <label for="soc">Soccerlabel> <input type="checkbox" name="s" id="bas"> <label for="bas">Baseballlabel>
- 1
- 2
- 3
- 4
预览
复选框允许用户选择一个或多个
Select 标签
<label for="city">City:label> <select name="city" id="city"> <option value="1">Sydneyoption> <option value="2">Melbourneoption> <option value="3">Cromwelloption> select>
- 1
- 2
- 3
- 4
- 5
- 6
预览
Sydney Melbourne Cromwell选择框是选项的下拉列表
Fieldset 标签
<fieldset> <legend>Your favorite monsterlegend> <input type="radio" id="kra" name="m"> <label for="kraken">Krakenlabel><br/> <input type="radio" id="sas" name="m"> <label for="sas">Sasquatchlabel> fieldset>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
预览
Your favorite monster
数据列表标签(HTML5)
<label for="b">Choose a browser: label> <input list="list" id="b" name="browser"/> <datalist id="list"> <option value="Chrome"> <option value="Firefox"> <option value="Internet Explorer"> <option value="Opera"> <option value="Safari"> <option value="Microsoft Edge"> datalist>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
预览
提交和重置按钮
<form action="register.php" method="post"> <label for="foo">Name:label> <input type="text" name="name" id="foo"> <input type="submit" value="提交"> <input type="reset" value="重置"> form>
- 1
- 2
- 3
- 4
- 5
- 6
预览
将数据提交到服务器
重置为默认值HTML input 标签
Input 属性
输入标记是一个空元素,用于标识要从用户处获取的特定类型的字段信息。
<input type="text" name="?" value="?" minlength="6" required />
- 1
:- :- type="…"
正在输入的数据类型 value="…"
默认值 name="…"
用于在 HTTP 请求中描述此数据 id="…"
其他 HTML 元素的唯一标识符 readonly
停止用户修改 disabled
停止任何交互 checked
单选或复选框是否选中 required
是强制性的,参阅必填 placeholder="…"
添加临时,请参阅::placeholder autocomplete="off"
禁用自动完成 autocapitalize="none"
禁用自动大写 inputmode="…"
显示特定键盘,请参阅inputmode list="…"
关联的datalist的id maxlength="…"
最大字符数 minlength="…"
最小字符数 min="…"
范围和编号上的最小数值 max="…"
范围和编号上的最大数值 step="…"
数字如何在范围和数字中递增 pattern="…"
指定一个正则表达式,请参阅pattern autofocus
集中精力 spellcheck
执行拼写检查 multiple
是否允许多个值 accept=""
file 中需要文件类型上载控件 请参阅:元素 的属性
Input 类型
type="checkbox"
type="radio"
type="file"
type="hidden"
type="text"
type="password"
type="image"
type="reset"
type="button"
type="submit"
HTML5 中的新输入类型
type="color"
type="date"
type="time"
type="month"
type="datetime-local"
type="week"
type="email"
type="tel"
type="url"
type="number"
type="search"
type="range"
Input CSS 选择器
input:focus
当键盘聚焦时 HTML meta 标签总结
Meta 标签
meta 标记描述 HTML 文档中的元数据。它解释了关于 HTML 的其他材料。
<meta charset="utf-8">
- 1
<title>···title> <meta property="og:title" content="···"> <meta name="twitter:title" content="···">
- 1
- 2
- 3
- 4
<link rel="canonical" href="https://···"> <meta property="og:url" content="https://···"> <meta name="twitter:url" content="https://···">
- 1
- 2
- 3
- 4
<meta name="description" content="网页描述···"> <meta property="og:description" content="···"> <meta name="twitter:description" content="···">
- 1
- 2
- 3
- 4
<meta property="og:image" content="https://···"> <meta name="twitter:image" content="https://···">
- 1
- 2
- 3
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- 1
- 2
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=1024">
- 1
- 2
- 3
<meta http-equiv="refresh" content="5;url=http://example.com/"> <meta name="robots" content="index,follow"> <meta name="generator" content="网站生成工具"> <meta name="csrf-token" content="token值">
- 1
- 2
- 3
- 4
- 5
常用 Meta
<meta name="description" content="网页描述···"> <meta name="keywords" content="关键词1,关键词2,关键词3"> <meta name="author" content="作者名">
- 1
- 2
- 3
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> <link rel="icon" href="favicon.png" type="image/png"> <link rel="icon" href="favicon.jpg" type="image/jpeg">
- 1
- 2
- 3
Open Graph
<meta property="og:type" content="website"> <meta property="og:locale" content="en_CA"> <meta property="og:title" content="HTML cheatsheet"> <meta property="og:url" content="https://jaywcjlove.github.io/"> <meta property="og:image" content="https://xxx.com/image.jpg"> <meta property="og:site_name" content="Name of your website"> <meta property="og:description" content="Description of this page">
- 1
- 2
- 3
- 4
- 5
- 6
- 7
Facebook、Instagram、Pinterest、LinkedIn 等使用。
Twitter 卡片
<meta name="twitter:card" content="summary"> <meta name="twitter:site" content="@QuickRef_ME"> <meta name="twitter:title" content="HTML cheatsheet"> <meta name="twitter:url" content="https://jaywcjlove.github.io/"> <meta name="twitter:description" content="Description of this page"> <meta name="twitter:image" content="https://xxx.com/image.jpg">
- 1
- 2
- 3
- 4
- 5
- 6
请参阅:Twitter 卡片文档
Geotagging
<meta name="ICBM" content="45.416667,-75.7"> <meta name="geo.position" content="45.416667;-75.7"> <meta name="geo.region" content="ca-on"> <meta name="geo.placename" content="Ottawa">
- 1
- 2
- 3
- 4
请参阅:Geotagging
标签语义化
复杂布局1
╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮ ┆
┆ ╰┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╯ ╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮ ┆ - 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
复杂布局2
╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮ ┆
┆ ┆ ╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮ ┆ ┆ ┆ - 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
区域语义化
╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈┈┈╮ ┆
┆ ┆ ┆ ┆ ╭┈┈┈┈┈┈┈┈┈┈┈╮ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ╰┈┈┈┈┈┈┈┈┈┈┈╯ ┆ ┆ ┆ ┆ ╭┈┈┈┈┈┈┈┈┈┈┈╮ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ╰┈┈┈┈┈┈┈┈┈┈┈╯ ┆ ┆ ┆ ┆ ╭┈┈┈┈┈┈┈┈┈┈┈╮ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ╰┈┈┈┈┈┈┈┈┈┈┈╯ ┆ ┆ ┆ ╰┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈┈┈╯ - 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
页面头语义化
╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮ ┆
┆ ┆ ╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮ ┆ ┆ ┆ ┆ ┆ ┆ ╰┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╯ ┆ ┆ ╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮ ┆ ┆ ┆ - 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
另见
- HTML 4.01 Specification (w3.org)
- HTML Tutorial (jaywcjlove.github.io)
- Emmet 备忘清单,提升 HTML 和 CSS 代码编写的工具包 (jaywcjlove.github.io)
数据知道的成长之路成长进阶、技术分享、资源获取微信公众号
注:本文转载自blog.csdn.net的数据知道的文章"https://cuiyonghua.blog.csdn.net/article/details/145979951"。版权归原作者所有,此博客不拥有其著作权,亦不承担相应法律责任。如有侵权,请联系我们删除。Scroll to Top - \
评论记录:
回复评论: