2021/09/27 meta,style ,link ,base
3.0 title 标签只能放在 head 中
3.1 meta 标签:
<!DOCTYPE html>
<html>
<head>
<title>第一个程序</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="学习Web开发,HTML5,CSS3">
<meta name="description" content="自学Web开发,打发无聊时光~">
<meta name="author" content="黑泥">
<!--网页自动跳转功能-->
<meta http-equiv="refresh" content="0; http://fishc.taobao.com">
</head>
<body>
<h1>Hello</h1>
<img src="img/FishC.png" alt="鱼C-Logo" width="256px" height="256px">
<a href="http://bbs.fishc.com">学习中遇到不会的问题,可以在鱼C论坛提问</a>
<p>I love FishC.com!</p>
</body>
</html>
4.0 style 标签 style 可以出现在 HTML 文档中的各个部分,一个文档也可以包含多个 style 标签
<style> 标签有三个属性:
media —— 指定样式适用的媒体
scoped —— 指定样式的作用范围 不常用
type —— 指定样式的类型
<style type="text/css" media="screen and (min-width:512px) and (max-width:1024px)">
body {
background-image: url("../img/bc2.png");
}
</style>
5.0 link 标签
1)使用 link 标签将 css 样式表保存为外部文件,链接进来;
<link rel="stylesheet" type="text/css" href="styles.css">
<link rel="stylesheet" type="text/css" media="print" href="print.css">
<link rel="stylesheet" type="text/css" media="screen and (min-width:512px) and (max-width:1024px)" href="screen512to1024.css">
2)设置链接网站小图标 —— favicon;
<link rel="icon" href="http://www.fishc.com/favicon.ico" type="image/x-icon">
5.1 base 标签
用于设置一个基准的 URL,此后,所有使用相对路径的链接就都会基于该 URL 进行跳转。
<base href="http://demo.fishc.com/html5/lesson4/" target="_blank">
base 标签会影响到上面路径设置,为了正确解析上面的路径,需要使用完整的 URL 代替相对路径(base 标签会影响当前文档中的所有相对路径)。
浙公网安备 33010602011771号