1. Overview of list tags
The table is used to display data, then the list is used to layout.
The biggest feature of the list is that it is neat, tidy and orderly, it will be more free and convenient as a layout
According to different usage scenarios, lists can be divided into three categories: unordered lists, ordered lists and custom lists
2. Unordered list (emphasis)
The <ul> tag indicates an unordered list of items in the HTML page. Generally, the list items are presented in bullets, and the list items are defined by the <li> tag.
2.1 The grammatical format of an unordered list
①There is no order level between the items in the unordered list, they are side by side
②<ul></ul> can only be nested in <li></li>, directly in the <ul></ul> tag The practice of entering other labels or text is not allowed.
③The space between <li> and </li> is equivalent to a container, which can hold all elements.
④The unordered list will have its own style attributes, but in actual use, we will use CSS to set
3. Ordered list (understanding)
An ordered list is a sorted list, and each list item will be arranged in a certain order and defined
In HTML tags, <ol> tags are used to define ordered tags, list sorting is displayed in numbers, and <li> tags are used to define list items.
3.1 The basic syntax format of an ordered list:
①<ol></ol> can only nest <li></li>, directly inputting other tags or text in the <ol></ol> tag is not allowed
②<li>and < /li>Equivalent to a container, can hold all the elements.
③The ordered list will have its own style attributes, but in actual use, we will use css to set it.
4. Custom list (emphasis)
4.1 Use scenarios of custom lists:
Custom lists are often used to explain and describe terms or nouns. There are no bullets before the list items in the definition list.
4.2 The grammatical format of the custom list
In HTML tags, the <dl> tag is used to define the description list (or definition list). This tag will be used together with <dt> (define item/name) and <dd> (describe each item/name).
①<dl></dl> can only contain <dt> and <dd>
② There is no limit to the number of <dt> and <dd>, often one <dt> corresponds to multiple <dd>
5. List summary
Recommended
Recommended browser: Google Chrome
Recommended Java environment: eclipse, IDEA
Recommended learning this week: HTML and CSS
Recommended learning video link: https://www.bilibili.com/video/BV1CK411G7m4?from=search&seid=9778818247834758128
Recommended HTML environment: VScode (Visual Studio Code)
Recommended practice location: https://leetcode-cn.com/