HTML Language Quick Start Guide

HTML Language Quick Start Guide

preface:

HTML (Hypertext Markup Language) is a markup language used to create web pages. It takes the form of markup and uses tags to define the structure and presentation of page content. This article will help you understand the basics of HTML and provide a quick start so you can start writing simple HTML web pages.

What is HTML

  • HTML is the basic building block of web pages, which describes the structure and content of the page.
  • HTML uses tags to mark various elements such as titles, paragraphs, images, links, etc.
  • HTML files usually have the extension ".html" or ".htm".

Create a simple HTML page

  • Open a new file using a text editor (e.g. Notepad++, Sublime Text, etc.).
  • Enter the following code as the basic HTML page structure:
<!DOCTYPE html>
<html>
<head>
  <title>我的第一个HTML页面</title>
</head>
<body>
  <h1>欢迎来到我的网站!</h1>
  <p>这是一个示例段落。</p>
</body>
</html>

HTML basic structure analysis

  • <!DOCTYPE html>: This is a document type declaration indicating that the document uses the HTML5 standard.
  • <html>: The root element of the HTML document, which contains the content of the entire page.
  • <head>: Header element, used to define the metadata of the document and introduce external resources.
  • <title>: Title element, which defines the title displayed in the browser tab bar.
  • <body>: The main element of the page, which contains the visible page content.

HTML tags and elements

  • Tags are the basic unit of the HTML language and are used to define different types of elements.
  • Example tags:<h1>...</h1> represents a first-level heading, <p>...</p> represents a paragraph, etc.
  • Between the opening and closing tags is the content of the element.
  • Some tags can contain other nested tags, forming a hierarchy of tags.

Commonly used HTML elements

  • <h1>~<h6>: Title tag, indicating that from the first-level title to the sixth-level title, the importance is decreasing in order.
  • <p>: Paragraph tag, defines a paragraph.
  • <a href="URL">...</a>: Link tag, used to create hyperlinks.
  • <img src="image.jpg" alt="描述">: Image tag, used to add pictures.
  • <ul> and <li>: unordered lists and list item tags.
  • <table>, <tr>, and <td>: table, row, and cell labels.

Add styles and formatting

  • CSS (Cascading Style Sheets) can be used to add style and formatting to HTML pages.
  • External CSS statement:<link rel="stylesheet" href="styles.css">.
  • Internal connection method:<p style="color: red;">红色的段落文本</p>.

Run HTML page

  • Save the file as ".html" to a location of your choice.
  • Double-click the file and it will open in your default browser and display the HTML page you wrote.

end:

Congratulations! Now you have learned the basics of the HTML language and created a simple HTML page. This is just the tip of the iceberg in the world of HTML. You can continue to learn more advanced HTML elements, CSS styles, and JavaScript interactions. With practice and exploration, you'll be able to create richer and more complex web pages.

I hope you found this quick start guide helpful. I wish you success in using HTML to build amazing web pages!

Guess you like

Origin blog.csdn.net/m0_53157282/article/details/133271212