Original text: http://andymao.com/andy/post/104.html
Previous Section : Ordered ListAfter writing the unordered list and the ordered list, someone told me that these two articles were meaningless. If these two articles are only read in one-way reading, it is indeed meaningless, but the important thing about these two articles is to ask readers to add to their own thoughts. Ordered and disordered single tags are simple, just know how to use them, but I don’t think the key point is to know what this tag looks like, but the key point is to what kind of data is suitable for what kind of list. What kind of data is ordered and what kind of data is disordered? You must think after reading, so that you can learn things and your knowledge belongs to you.
The definition list has a special form and usage. Compared with the disordered list, there are much fewer definition lists. There are also many friends who have not started using this list yet, so let’s break down the code of this list:
<dl>
<dt></dt>
<dd></dd>
</dl>
Looking at the above code, we found that there is no <li> tag here, but consists of three tags DL, DT, and DD. According to the appearance and the previous list, we can know that DL is a container of this list, just like a box. The difference is that this time the box is not only a single small box with a unified standard. Instead, there are two different contents, how do we understand DT and DD? Semantically, DT is the name, the title, and DD is the explanation, the content. DT and DD are both boxes, DD only interprets one of the DTs above, and cannot be explained further or downward. When DT does not exist, then DD has no meaning, and whether DT must need DD to follow it, I have not found the exact literature to illustrate this point, but based on my understanding of the definition list, I think if there is only DT in the data but no DD, then this cannot be a definition list, and just use the UL unordered list. But when there are only one or a few in the data that do not have DD, and most of them have DD, then I think this form can exist.
<dl>
<dt>Sorted List</dt>
<dt>Sorted List</dt>
<dt>Sorted List</dt>
<dt>Sorted List</dt>
</dl>
The above is obviously inappropriate. This form is an unordered list. Why do you need to use a definition list? It doesn't make sense in terms of semantics.
<dl>
<dt>Sorted List</dt>
<dd>Sorted list is the data form organized by sequenced data in a list</dd>
<dt>Sorted List</dt>
<dd>Sorted list is the data form organized by sequenced data in a list</dd>
<dt>This sentence has no explanation</dt>
<dt>Sorted List</dt>
<dd>Sorted list is the data form organized by sequenced data in a list</dd>
</dl>
I personally think the above form is feasible. So can a DT carry multiple DDs? I also found no documentary instructions on this point, and there are still many such DT with multiple DDs in some well-known websites. My opinion on this is that it is OK to have multiple DDs in different situations, but generally I think this approach is still lacking. From the perspective of interpretation, do multiple DDs indicate multiple explanations? Or if you want to explain the content in segments, you don’t need to let DD be the dog catching rats. Many paragraph tags can be embedded in a DD. Furthermore, from the perspective of style applications, multiple DDs are loose as a whole, and their design is insufficiently extensible. For example, when we want to click DT to hide the corresponding DD effect, this practice of multi-DD is not so easy to implement. Therefore, if it is not a special purpose, try not to use one DT with multiple DDs as much as possible. Instead, put the content in DD. If it is segmented, let the paragraph label be used, and if it is segmented, let the orderly or unordered list be expressed.
Let’s start by talking about it. The label itself has nothing, and the key is to think about how to apply it. Let me give you a picture below to see if you should use a custom list. Let’s discuss it together.