📅  最后修改于: 2023-12-03 14:39:29.924000             🧑  作者: Mango
HTML (Hyper Text Markup Language) is the foundation of all web pages. It is used to create and structurize web pages, making them readable and understandable to both humans and machines. HTML allows you to add elements like text, images, videos, links, and more to your web pages.
To create an HTML document, all you need is a basic text editor like Notepad. Simply open a new document and save it with a .html extension. Once you've done that, you can start writing your HTML code.
The basic structure of an HTML document is as follows:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Let's break this down step by step.
This is the first line of any HTML document. It tells the browser which version of HTML the document is written in. In this case, we're using HTML5.
These tags enclose the entire content of the document, including the head and body sections.
This section contains information about the document that isn't displayed on the page itself. For example, the title of the page is included here.
The title of the page is what appears in the browser's title bar at the top of the screen.
This is where you add the actual content that will be displayed on the page.
This is a heading tag. The number inside the tag (in this case, 1) determines the size of the heading. The larger the number, the smaller the heading.
This is a paragraph tag. It's used to add text to the page.
Here are some of the most commonly used HTML elements:
<h1>
- <h6>
: Headings of various sizes.<p>
: Paragraphs of text.<strong>
: Bold text.<em>
: Italic text.<u>
: Underlined text.<br>
: Line break.<a href="">
: A hyperlink. The href
attribute is used to specify the URL the link should point to.<img src="" alt="">
: An image. The src
attribute is used to specify the URL of the image, and the alt
attribute is used to provide alternative text for the image (in case it can't be displayed).<ul>
: An unordered list.<ol>
: An ordered list.<li>
: A list item.HTML may seem intimidating at first, but it's really quite simple once you get the hang of it. With these basic HTML elements, you can create a wide variety of web pages.