HTML之 一 标签

时间:2023-11-24 09:19:44

一 ,标签分类:

1.普通标签:

<h1> hello </h1>

hello

2.自闭和标签

<hr/>

二,书写html注意事项

1.标签不能交叉嵌套

2. 标签推荐使用小写

3.标签应该缩进

三,标签的属性:

1. 通常以键值对形式出现,并且放在开始标签中 例如(id="kaka")

<h1 id="kaka">  hello </h1>

2.属性名都是小写的例如: id

3.特殊的属性,属性名 与属性值一样,只写属性名即可

<input readonly>  
等同于
<input readonly="readonly">

标签简介:

1. <!DOCTYPE html>标签:

提示浏览器以W3C标准模式解析

如果不加,浏览器将以非标准模式解析

2.<head> </head>中的标签:

<meta>标签与非<meta标签>

a.<meta>标签 属性: http-equiv 和 name

name属性:

<head>
<meta name="keywords" content="程序员 it"> (爬虫关键字)
<meta name="description" content="博客园是xxxx..."> (爬取后显示的描述)
</head>

http-equiv属性:

<meta http-equiv="Refresh" content="2;URL=https://www.baidu.com"> //(注意后面的引号,分别在秒数的前面和网址的后面,如果没有网址就会在秒数内自动刷新当前页面)
<meta http-equiv="content-Type" charset=UTF8"> //(以何种文件模式解析)
<meta http-equiv = "X-UA-Compatible" content = "IE=EmulateIE7" /> //(IE 兼容到ie7,只对ie浏览器有效)

b.非 <meta)标签。

1.<title> </title> 网页的title文字

<title>hello </title>

2.<link>引入资源

网页的title图片(必须是ico图片)引入

<link rel="icon" href="girl.ico">  // 本地路径的图片
<link rel="icon" href="http:////www.jd.com/favicon.ico"> //网上路径图片

还可以引入css

3.<script> </script>引入js

3.<body> </body>中的标签:

a.<h1></h1> 标题标签

b.<p> </p>   段落标签

c. 最重点之 <div> </div>是块级标签(block标签,占满整行) & <span> </span>是内联标签(In-line标签,一行内可以放多个)

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!--<meta http-equiv="Refresh" content="2;URL=https://www.baidu.com">-->
<!--<link rel="icon" href="http:////www.jd.com/favicon.ico">-->
<title>Title</title>
<style>
div{
color:#cc3399;
background-color: yellow;
}
span{
color: green;
background-color: yellow;
}
</style>
</head>
<body>
hello before <div>hello div</div> hello after <br/>
span before <span>hello span</span> span after
</body>
</html>

HTML之 一 标签

其它标签:

    <b>  字体加粗 </b>
<em> 斜体字 </em>
<strike>划除标签</strike>
<del>划除标签推荐</del>
  2<sub>3</sub> //下脚标
  2<sup>3</sup> //上脚标
 

HTML之 一 标签

特殊符号:

  hello &nbsp; li   // &nbsp; 空格符
&copy; //&copy; 版权符号
 &lt;h1&gt; //&lt;小于号 &gt;大于号

HTML之 一 标签