Home  >  Article  >  Web Front-end  >  Some commonly used HTML tags and their usage

Some commonly used HTML tags and their usage

PHPz
PHPzOriginal
2023-04-21 14:13:17697browse

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>
  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>
  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">
  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>
  1. List tag

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

    ), list items are represented by an unordered symbol (usually a dot). In an ordered list (
      ), list items are represented by numerical numbers. Each list item is represented by a
    1. tag.

      <ul>
          <li>列表项1</li>
          <li>列表项2</li>
          <li>列表项3</li>
      </ul>
      
      <ol>
          <li>列表项1</li>
          <li>列表项2</li>
          <li>列表项3</li>
      </ol>
      1. Table tag

      The table in HTML consists of three tags:

      , ,
      . Among them, the tag is used to define a table, the tag defines a row in the table, and the
      tag defines a cell in the table. You can use CSS styles to set the width, background color, border and other properties of the table.

      <table>
          <tr>
              <td>单元格1</td>
              <td>单元格2</td>
              <td>单元格3</td>
          </tr>
          <tr>
              <td>单元格4</td>
              <td>单元格5</td>
              <td>单元格6</td>
          </tr>
      </table>

      The above are the usage of some HTML tags, and there are many other tags that can be used in web pages. Through these tags, you can quickly create and modify the content and structure of web pages.

      The above is the detailed content of Some commonly used HTML tags and their usage. For more information, please follow other related articles on the PHP Chinese website!

      Statement:
      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