HTML Basics Study Guide: Master HTML Tags from Scratch

HTML (Hypertext Markup Language) is the basic language for building web pages, and can be used to define various elements such as text, images, multimedia content, and forms. Knowing HTML is essential if you want to be a web developer. In this article, we will take you to learn the basic tags of HTML step by step, and master the HTML language from scratch.

  1. HTML document structure

HTML documents consist of two parts: the head (head) and the body (body). The header usually contains metadata such as the title and description of the document. The body contains the content of the web page. Normally, an HTML document should look like this:

<html>
  <head>
    <title>文档标题</title>
  </head>
  <body>
    <p>这是一段文本。</p>
  </body>
</html>
  1. HTML basic tags

Next, we will introduce the basic tags commonly used in HTML.

2.1 Title tags

The title tag is used to define the title of the web page. There are six levels (from h1 to h6), h1 is the highest level title, and h6 is the lowest level title.

<h1>这是一个一级标题</h1>
<h2>这是一个二级标题</h2>
<h3>这是一个三级标题</h3>
<h4>这是一个四级标题</h4>
<h5>这是一个五级标题</h5>
<h6>这是一个六级标题</h6>

2.2 Paragraph tags

Paragraph tags are used to define paragraphs in web pages, and the &p tag is used to define paragraphs.

<p>这是一个段落。</p>

2.3 Link labels

The link tag is used to define a hyperlink, and the &a tag is used to specify the address, text and location of the link (open in the current page or in a new tab).

<a href="http://www.example.com" target="_blank">点击这里,请跳转到示例网站</a>

2.4 Image Labeling

Image tags are used to render images, using the img tag. To display an image, the URL of the image must be specified. Alternatively, alternative text can be specified for images to give a human-readable alternative when the image cannot be displayed

<img src="image.png" alt="这是一张图片">

2.5 List Labels

List tags are used to create ordered or unordered lists. Ordered lists number list items, while unordered lists identify list items as symbols.

Ordered list:

<ol>
  <li>列表项1</li>
  <li>列表项2</li>
  <li>列表项3</li>
</ol>

Unordered list:

<ul>
  <li>列表项1</li>
  <li>列表项2</li>
  <li>列表项3</li>
</ul>

2.6 Table Tab

Table tags are used to create tables. Among them, the th tag is used to define the header cell, and the td tag is used to define the data cell.

<table>
  <tr>
    <th>表头1</th>
    <th>表头2</th>
  </tr>
  <tr>
    <td>数据1</td>
    <td>数据2</td>
  </tr>
</table>

The above are the basic tags commonly used in HTML. By learning these tags, you can create a simple web page.

In the process of learning HTML tags, don't forget to practice, write more and read more, so that you can better grasp the HTML language.

Let's start your HTML programming journey

Guess you like

Origin blog.csdn.net/canshanyin/article/details/131160009