Home >Web Front-end >Front-end Q&A >html$ usage
HTML stands for Hyper Text Markup Language, which is a language used to create web pages. HTML has a very wide range of application scenarios, from simple traditional web pages to complex websites and applications, all of which can be developed with HTML. This article aims to introduce the basic usage of HTML and some practical skills so that beginners can get started quickly.
In HTML, file names ending in .html or .htm are usually used as web page files. When you open an HTML page, the browser parses the structure of the HTML document and displays them on the visual interface.
HTML document consists of three main parts: Head, Body and Footer. These parts are composed of HTML tags. The following code shows a simple HTML document example:
<html> <head> <title>这里是标题</title> </head> <body> <h1>欢迎使用HTML</h1> <p>这里是文本内容。</p> </body> </html>
In the above example, the "100db36a723c770d327fc0aef2ce13b1" and "73a6ac4ed44ffec12cee46588e518a5e" tags are used to represent the entire HTML document, and "93f0f5c25f18dab9d176bd4f6de5d30e " and "9c3bca370b5104690d9ef395f2c5f8d1" tags are used to represent the head of the document, where "b2386ffb911b14667cb8f0f91ea547a7" and "6e916e0f7d1e588d4f442bf645aedb2f" tags are used to define the title of the document. The "6c04bd5ca3fcae76e30b72ad730ca86d" and "36cc49f0c466276486e50c850b7e4956" tags are used to represent the main body of the document, among which the "4a249f0d628e2318394fd9b75b4636b1" and "473f0a7621bec819994bb5020d29372a" tags define the first-level headings, and the "e388a4556c0f65e1904146cc1a846bee ” and “94b3e26ee717c64999d7867364b1b4a3” tags define a section of text.
HTML tags are divided into two types: block-level tags and inline tags.
The following are some commonly used HTML tags:
Tag description
4a249f0d628e2318394fd9b75b4636b1–4e9ee319e0fa4abc21ff286eeb145ecc Define title
01ffcd5d1a840d2341909ced6bafa76c Define paragraph
a1f02c36ba31691bcfe87b2722de723b Define image
ff6d136ddc5fdfeffaf53ff6ee95f185 Define unordered list
c1f29b38bc64cc2f1051d7d21b6e3e21 Define list items
Define header cell | Define table data cells
dc6dce4a544fdca2df29d5ac0ea9906b defines a section or paragraph in the document
45a2772a6b6107b401db3c9b82c049c2 defines sections in the document
Define emphasized text
Define emphasized text
3. HTML comments
Comments are a way in code to describe the intent of the code. You can use "2b70443f3def157d1848e0c769cb1e86" tags in HTML to include comment content, and the browser will automatically ignore these contents. Here is an example of an HTML comment:
`
ef0c1c6ed77da4afcd1285376eee1aca
e388a4556c0f65e1904146cc1a846beeHere is the text94b3e26ee717c64999d7867364b1b4a3
`
In the above example, the "2b70443f3def157d1848e0c769cb1e86" tags are used to comment out the content of the paragraph mark e388a4556c0f65e1904146cc1a846bee. This will not have any impact on the browser's output, but it can Improve code readability and maintainability.
4. HTML attributes
HTML tags can have attributes, which are used to control the behavior and characteristics of the tag. Properties usually include property names and property values, which need to be wrapped in quotes. The following is an HTML hyperlink tag with attributes:
`
Visit Baidu
`
In the above example, "href" is the attribute name, and its attribute value is a URL address, "https://www.baidu.com". This URL address is designated to link to a web page.
In addition to "href", there are many other commonly used attributes in HTML, as shown below:
Property name Description
style defines the style of the element
class defines the class name of the element
id defines the element ID
title defines the title of the element
src defines the URL address of the image
5. HTML style
HTML markup can use CSS styles to define appearance and layout. CSS refers to Cascading Style Sheets, which is a language used to describe the appearance and layout of web pages. Here's an example that shows how to style HTML text:
`
100db36a723c770d327fc0aef2ce13b1
93f0f5c25f18dab9d176bd4f6de5d30e
c9ccee2e6ea535a969eb3f532ad9fe89
p {
color: red;
font-size: 16px;
}
531ac245ce3e4fe3d50054a55f265927
9c3bca370b5104690d9ef395f2c5f8d1
6c04bd5ca3fcae76e30b72ad730ca86d
e388a4556c0f65e1904146cc1a846beeHere is red text with a font size of 16px. 94b3e26ee717c64999d7867364b1b4a3
36cc49f0c466276486e50c850b7e4956
73a6ac4ed44ffec12cee46588e518a5e
`
In the above example, the CSS style is included in the 93f0f5c25f18dab9d176bd4f6de5d30e tag of the HTML document. Among them, the "p" selector is used to select text, while the "color" and "font-size" properties are used to define the color and font size of the text.
6 Conclusion
This article introduces the basic usage of HTML and some practical skills. HTML is the basis for building web pages and applications. Learning it will help you better understand and develop web pages. Of course, this article only introduces part of HTML. If you want to learn more in-depth knowledge, you can check out more detailed HTML tutorials and documents.
|
---|
The above is the detailed content of html$ usage. For more information, please follow other related articles on the PHP Chinese website!