Web 开发是当今最受欢迎的技能之一。它涉及创建可通过浏览器访问的用户友好且引人入胜的网站。成为 Web 开发人员的第一步是了解 HTML。
HTML(超文本标记语言)是任何网页的支柱。它是用于构建网页的标准语言,决定内容在浏览器中的显示方式。虽然页面的外观由 CSS (层叠样式表) 决定,其功能由 JS (Javascript) 决定,HTML 负责基本骨架或结构。
在深入学习这部分课程之前,了解您的旅程中将使用的著名和反复出现的术语非常重要。这些将帮助您随着我们的进展理解概念(也让作者更容易解释事情;-))。
的标签(paragraph) 在其中,浏览器创建一个主体节点,并以段落节点作为其子节点。
) 将被视为 div 的子级。
HTML 代表 超文本标记语言
超文本:指 HTML 将不同文档链接在一起的能力。
标记语言:使用标签来注释文本,定义文本在浏览器中的显示方式。
这是 HTML 文档的基本结构:
<!DOCTYPE html> <html> <head> <title>HTML Tutorial</title> </head> <body> <p>Hello, world!</p> </body> </html>
标签:在 HTML 中,标签用于定义元素。标签括在尖括号中,例如 或
。
元素:由开始标签和结束标签组成,其中可能包含内容。例如,
你好,世界!
是一个段落元素。每个 HTML 文档都遵循一个基本结构:
Here are some basic HTML elements you’ll use frequently:
To create an HTML file, you can use any text editor, such as Notepad or VS Code. Here’s a simple example:
<!DOCTYPE html> <html> <head> <title>HTML Tutorial</title> </head> <body> <h1>Example Number 1</h1> <p>Hello, world!</p> </body> </html>
You can find that there is a request in the name that you have saved as in this picture.
In the response tab, you will find the code that you have written as in the following picture
Now, what happened is that, once you opened the file you have saved as html, the computer began running the file in browser. The browser wanted something to show, so it made a request call to the file from which it was launched. The file gave the browser your code and that was found in the response section. Since it was a html file, the browser begins reading the HTML code from the top to the bottom. This process is known as parsing. During parsing, the browser encounters different HTML tags (like ,
, , etc.) and starts to build a structure called DOM based on these tags. As the browser builds the DOM, it simultaneously renders the content on your screen.Let’s take a step further by creating a simple table in HTML:
<p>Table Example</p> <table> <tr> <th>Name</th> <th>Power</th> <th>Is Kurama Present</th> </tr> <tr> <td>Naruto</td> <td>Rasengan</td> <td>Yes</td> </tr> <tr> <td>Sasuke</td> <td>Sharingan</td> <td>No</td> </tr> </table>
Notice the heading is being rendered by paragraph tag. Alternatively, you can also use
Note that