5.HTML标题标签级别
HTML标签的标题标签可以分为多级 ,但最高只能分为6级,即<h1>到<h6>。
<h1>的级别最高,<h6>的级别最低。
!注意:标题标签只能用来定义标题,不能对内容进行其他文本设计;要由高到低的使用标题标签。
标题标签代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>新疆第二医学院</title>
</head>
<body>
<h1>标题1</h1>
<h2>标题2</h2>
<h3>标题3</h3>
<h4>标题4</h4>
<h5>标题5</h5>
<h6>标题6</h6>
</body>
</html>
运行结果如下:
6.HTML段落标签<p>
段落标签<p>是双标签,即有开始标签和结束标签。但是在之前的版本中,段落标签的结束标签可以省略,浏览器进行自动补全。
段落标签可以有多个。
段落标签中可以换行,但浏览器在运行时,会把编写中的多个连续的空格、回车换行当做一个空格来处理。
具体代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>新疆第二医学院</title>
</head>
<body>
<p>The Art of War was written by Sun Wu, a famous ancient
Chinese strategist. A classic work not only of military value but
also of great philosophical significance, The Art of War is a
precious heritage of brilliant ancient Chinese culture.
In his book, Sun Wu disclosed a series of military rules and principles
of universal significance , and put forward a complete system of
military theory.
His theory has been highly regarded by
strategists since the Warrings States Period and exerted strong
impacts on their thought and practice. Moreover, it has yielded a
worldwide influence in the field of military thought, enjoying
extremely high prestige.
</body>
</html>
运行结果如下:
在段落标签中想要换行,就加入换行标签<br/>。
具体代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>新疆第二医学院</title>
</head>
<body>
<p>The Art of War was written by Sun Wu, a famous ancient
Chinese strategist.
<br/>A classic work not only of military value but
also of great philosophical significance, The Art of War is a
precious heritage of brilliant ancient Chinese culture.
<br/>In his book, Sun Wu disclosed a series of military rules and principles
of universal significance , and put forward a complete system of
military theory.
<br/>His theory has been highly regarded by
strategists since the Warrings States Period and exerted strong
impacts on their thought and practice. Moreover, it has yielded a
worldwide influence in the field of military thought, enjoying
extremely high prestige.
</body>
</html>
运行结果如下:
7.文本格式化(双标签)
在HTML标签中,可以对文本进行绚丽的设置,就有对应的标签来实现这些设置。
按照作用的不同,可以将这类标签分为两类:物理标签和逻辑标签。物理标签用来设置外观,逻辑标签用来赋予语义值。
格式化标签有加粗文本的<b>、<strong>标签;设置文本为斜体的<em>、<i>标签;还有定义上下标文本的<sup>和<sub>等的标签。
!注意区别:<b>是对多数文字加粗,而<strong>是对于少部分文字,起强调作用;<i>和<em>标签与之同理。
具体代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>新疆第二医学院</title>
</head>
<body>
<p>
<b>实现中华民族伟大复兴</b>是近代以来中国人民伟大的<strong>梦想</strong>,我们称之为“中国梦”,其基本内涵是实现国家富强、
民族振兴、人民幸福。中国梦,是让每一个积极进取的中国人形成世世代代的信念:只要经过不懈的奋斗便能获
得更好的生活。<i>人们必须通过自己的勤奋、勇气、创意和决心迈向繁荣,而不是依赖于社会和他人的援助。</i>每个
中国人都是中国梦的参与者和<em>创造者</em>。中国梦是民族的梦,也是每个中国人的梦。
</p>
</body>
</html>
运行结果如下:
8.超链接标签<a>(双标签)
超链接标签中的属性是href,target。href属性是指向的链接,target属性指向页面的打开方式。
target属性中的属性值有多个,常用的是_self(默认的,原窗口会被覆盖)、_blank(打开新窗口)。
标签样式:鼠标样式、颜色和下划线。
9.<img>标签
<img>标签可以插入图片,同时可以设置高度height和宽度width。也可以用style属性来指定。
图片的属性中有<picture>、<source>标签。在<picture>标签的最后必须定义一个<img>标签,必须是最后一个子元素。
<img>标签中,alt前的属性显示不了时则显示alt后的属性。
图像映射,即学即用。