Some commonly used HTML tags and their usage

PHPz
Release: 2023-04-21 14:38:35
Original
658 people have browsed it

HTML (HyperText Markup Language) is a standard language for creating and publishing websites. HTML is defined based on a set of tags that describe the structure and content of a web page. In this article, we will introduce some commonly used HTML tags and their usage.

  1. Title Tag

Six different levels of title tags are used in HTML to describe the content hierarchy of the document. From the highest level to the lowest level they are: h1, h2, h3, h4, h5, h6. Among them, h1 is the highest level and h6 is the lowest level. Generally, a page only uses one h1 tag, and other levels of tags are used to describe different levels of subtitles or content. Here is a simple example:

<h1>这是主标题</h1>
<h2>这是次级标题</h2>
<p>这是一段内容</p>
<h3>这是三级标题</h3>
<p>这是另一段内容</p>
Copy after login
  1. Paragraph and line break tags

In HTML, the

tag represents a paragraph and is used to break a block of text from above separated in a block. In a paragraph, spaces and carriage returns are only considered as single spaces. If you need to output multiple spaces in the same paragraph, you can use the space entity in HTML. If you need to force a line break, you can use the
tag.

<p>这是第一段的内容。    这是第一段的另一行文本。</p>
<p>这是第二段的内容。</p>
<p>这是第三段的内容。<br>这些是第三段的第二行。</p>
Copy after login
  1. Image tag

The tag in HTML is used to embed images in web pages. To use this tag, you need to provide the URL of the image and some properties, such as image size, border and text description.

<img src="image.jpg" alt="这是一张图片" width="500" height="500" border="1">
Copy after login
  1. Hyperlink tag

In HTML, the tag is used to create a hyperlink. The URL pointed to can be a page of the current website, another website, or any other material. When using the tag, you must provide the text of the hyperlink. The text can be any word or phrase you want users to see. In the tag, use the href (hyperlink reference) attribute to specify the URL of the link.

<a href="http://www.baidu.com">访问百度</a>
Copy after login
  1. List tag

HTML contains two different list tags: unordered list and ordered list. In an unordered list (