HTML基本结构知识点总结
文章目录
一、文档结构标签
1. <html>标签
表示文件以HTML编写,成对出现(<html>…</html>)
2. <head>标签
-
定义文件头部,包含文档元信息
-
常用子标签:
-
<base>:设置基底URL -
<title>:定义浏览器标题栏显示内容 -
<meta>:提供文档元信息 -
<style>:定义CSS样式<style type="text/css"> CSS样式 </style> -
<script>:包含JavaScript代码<script> JavaScript代码 </script> -
<link>:链接外部资源
-
3. <title>标签
-
嵌套在
<head>中,定义网页标题 -
语法:
<title>标题内容</title>
4. <body>标签
- 定义文档主体内容,支持多种视觉属性:
-
文字颜色:
text="颜色代码" -
背景色:
bgcolor="颜色代码" -
背景图:
background="图片路径"-
控制平铺:需配合CSS
background-repeat:<head> ........ <style type="text/css"> body{ background-repeat:no-repeat/repeat-x/repeat-y; background-attachment:fixed; <!--固定背景,等同于bgproperties--> } </style> </head> -
固定背景:
bgproperties="fixed"
-
-
链接颜色控制:
link:默认链接色alink:点击时链接色vlink:已访问链接色
-
边距设置:
topmargin="像素值":上边距leftmargin="像素值":左边距
-
二、元信息标签<meta>
1. 搜索引擎优化类
-
关键字设置:
<meta name="keywords" content="关键词1,关键词2"> -
页面描述:
<meta name="description" content="描述文本"> -
限制搜索方式:
<meta name="robots" content="index|noindex|follow|nofollow">
2. 文档信息声明类
-
编辑器标识:
<meta name="generator" content="软件名"> -
作者信息:
<meta name="author" content="作者名"> -
版权声明:
<meta name="copyright" content="``版权信息``"> -
建站日期:
<meta name="build" content="日期"> -
联系人邮箱:
<meta name="reply-to" content="邮箱">
3. HTTP标头控制类
-
字符集设置:
<meta charset="UTF-8"> <!--HTML5简写--> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <!--传统写法--> -
网页跳转:
<meta http-equiv="refresh" content="秒数;url=目标地址"> -
页面过期时间:
<meta http-equiv="expires" content="GMT时间"> -
禁用缓存:
<meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="pragma" content="no-cache"> -
独立窗口打开:
<meta http-equiv="windows-target" content="_top">
三、基底标签 <base>
-
设置基底URL:
<base href="http://example.com/" target="_blank"> -
target属性值:
- _blank:新窗口打开
- _self:当前窗口打开(默认)
- _parent:父框架打开
- _top:整个窗口打开
四、链接标签<link>
<link rel="关系类型" href="资源URL" [其他属性]>
-
重要属性说明
-
rel:定义当前文档与链接资源的关系(必需) -
href:指定资源的 URL(必需) -
type:指定资源的 MIME 类型(如text/css、image/svg+xml) -
media:指定样式表适用的设备(如screen、print、(max-width: 768px))
-
五、注释标签
- 语法:
<!-- 注释内容 --> - 不显示在页面,用于代码说明
8万+

被折叠的 条评论
为什么被折叠?



