Home > Web Front-end > HTML Tutorial > Analysis of commonly used tags in html (with code)

Analysis of commonly used tags in html (with code)

不言
Release: 2018-08-30 11:54:23
Original
1901 people have browsed it

The content of this article is about the analysis of commonly used tags in HTML (with code). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

1.1 Classification of tags

1.1.1 Classification by subject:

1. Tags with subject : Such as data

2. Label without subject: such as
Line break label

Determine whether a table needs to be Subject, you can think about whether the tag needs to encapsulate data. If it needs to encapsulate data, then the tag must have a body. If it does not need to encapsulate data, then there is no need to have a body .

2.1.2 Classification by line :

1. If the content of a label needs to occupy an independent line, we call it a block label. For example:

Title tag

2. If a tag does not need to occupy a separate line, we call it an inline tag. For example: Font tag

2.2 Text tag:

h1~h6Title tag, hrDraw a horizontal lineBold the font, which has the same function as the strong tagSet the font to italicfontFont (obsolete in HTML5)color: color size: size face: the name of the specified fontpParagraph, each p tag is a paragraph, there is no first line indentation. There are gaps between paragraphs

2.3 块标签与内联标签

1.div:块标签,需要独立占一行。

2.span:内联标签,不需要独立占一行。

案例文字素材

World Wide Web Consortium

万维网联盟创建于1994年

代码演示

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css"></style>
    <script type="text/javascript"></script>
</head>
<body>
<div style="background-color: red">World Wide Web Consortium</div>
万维网联盟创建于1994年
<span style="background-color: aqua">World Wide Web Consortium</span>
万维网联盟创建于1994年
</body>
</html>
Copy after login

2.4 列表标签

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css"></style>
    <script type="text/javascript"></script>
</head>
<body>
今天早上吃什么?
<ol style="color: black" type="A">
    <li>
        油条
    </li>
    <li>
        豆浆
    </li>
    <li>
        稀饭
    </li>
</ol>
明天早上吃什么?
<ul style="color: black" type="disc">
    <li>面</li>
    <li>糯米鸡</li>
</ul>
</body>
</html>
Copy after login

2.5 实体字符

2.5.1 为什么需要使用到实体字符

在HTML页面中,有些字符是有着特殊含义的字符,如果需要在网页上显示这种特殊的字符,那么就需要使用到该特殊字符对应的实体字符。比如:< 小于号 > 大于号

2.5.2 实体字符列表

注释:实体名称对大小写敏感!

2.5.3 常用的实体字符

#Tag name Tag description Common attributes
All titles are bold , 1 means level 1 heading, the largest word size, level 6 heading is the smallest Attribute is

inside the start tag

align:Set title alignment

center: center, right: right-aligned, left: left-aligned

width: Line length size: Thickness color: Color
b
i
br Line break

If you want to indent, use

 ; half-width space can also be full-width space

titleWhen the mouse is moved up, text prompt information will be displayed

特殊的字符 对应的实体字符
< <
> >
空格

¥

© 版本所有 ©
® ®
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css"></style>
    <script type="text/javascript"></script>
</head>
<body>
&lt;h1&gt;标签是标题标签<br/>
       百度(纳斯达克:BIDU),全球最大的中文搜索引擎、最大的中文网站。
1999年底,身在美国硅谷的李彦宏看到了中国互联网及中文搜索引擎服务的巨大发展潜力,
抱着技术改变世界的梦想,他毅然辞掉硅谷的高薪工作,携搜索引擎专利技术,于 2000年1月1日在中关村创建了百度公司。<br/>
青岛啤酒:&yen;16元一瓶。<br/>
《java从入门到放弃》:&copy; XXX版权所有<br/>
本次活动解释权归XXX公司所有:&reg;XXX有限公司
</body>
</html>
Copy after login

2.6 图像标签(img)

2.6.1 标签的作用

在网页中显示图片

2.6.2 常用的属性

属性名 作用
src source图片文件地址,注:不能使用客户端本地地址,如:c:/aaa.jpg
width 图片宽度,如果只指定宽和高,另一个参数会等比例缩放
height 图片高度
alt 如果图片丢失,图片显示的文字
title 如果鼠标移到图片上,显示提示文字信息
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css"></style>
    <script type="text/javascript"></script>
</head>
<body>
<img src="img/11.jpg" height="500" width="200" title="这个是一辆豪车" />
</body>
</html>
Copy after login

相关推荐:

html标签之meta标签_html/css_WEB-ITnose

HTML常用标签

The above is the detailed content of Analysis of commonly used tags in html (with code). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template