how to write html

WBOY
Release: 2023-05-21 09:51:06
Original
756 people have browsed it

HTML (Hypertext Markup Language) is a markup language used to build web pages. It is the basis for building web pages. In this article, we'll cover how to write HTML and add style and functionality to your website.

  1. Writing HTML documents

HTML documents are composed of tags, and tags can be nested. Each tag has an opening tag and a closing tag, for example:

  这是网页标题 

欢迎来到我的网站

这是一个段落

Copy after login

In this example, we have a root tag of HTML, atag that contains the title of the web page, and a the ; tag contains the content of web page. within tag, we have an >

tag for the heading and a

tag for the paragraph.

  1. Tags and attributes

HTML tags can have attributes to specify the characteristics of the tag. For example, thetag can specify the URL of the image through the src attribute, as shown below:

这是图像的描述
Copy after login

In this example, we specify the URL of the image using the src attribute, and the alt attribute provides a description of the image.

  1. Links

In a web page, we can add links to other web pages or local files. Use thetag to create a link, for example:

In this example, we use the href attribute to specify the URL of the link target.

  1. List

We can use lists to organize information. HTML has two types of lists: ordered lists and unordered lists. Ordered lists use the

    tag, while unordered lists use the
      tag. For example:

      1. 第一项
      2. 第二项
      3. 第三项
      • 第一项
      • 第二项
      • 第三项
      Copy after login

      In this example, we use the

        tag to create an ordered list, and the
          tag to create an unordered list.

          1. Style

          We can use CSS (Cascading Style Sheets) to add styles to the website. CSS is a style sheet language used to describe the appearance and layout of web pages. For example:

          In this example, we embed the