can be used to mark up a glossary of terms, althou...">

When to use dfn and dt together?

According to the HTML5Doctor article on the dl element : " <dl> can be used to mark up a glossary of terms, although you should remember to use <dfn> to indicate that the word is defined [in the same document]." Note: the language in square brackets is mine. The article provides this markup:

 <dl> <dt><dfn>RSS</dfn></dt> <dd>An XML format for aggregating information from websites whose content is frequently updated.</dd> </dl> 

Please note that the term "RSS" is enclosed in dt and dfn tags.

My question is: why should we remember that we use dfn ? This is not explainable convincingly. I am looking for a final explanation of using dfn , as well as some specific examples.

Note. I looked at the documentation for dfn tags from W3C , but this did not answer my question.

Additional background and links

Interestingly (or not), according to the HTML5Doctor article, the dl element was renamed the "description list" in HTML5. This used to be a "definition list". From the W3C Working draft in the description list :

The dl element represents a list of descriptions, which consists of zero or more grouped description terms (name-value); each grouping associates one or more terms / names (contents of dt elements) with one or more descriptions / values ​​(contents of dd elements).

+6
source share
3 answers

Interestingly (or not), according to the HTML5Doctor article, the dl element was renamed the "description list" in HTML5.

This sums up; Now that dl no longer applied exclusively to definition lists, but for any lists containing terms and their corresponding descriptions, it is recommended that you use the dfn tag to indicate that the contents of dt are actually a definition term ; that is, a term whose description is in fact its definition (something will necessarily happen in the previous specifications, but not in HTML5).

It is confusing, I know, but what is the main idea: use dfn in dt if the content of dt is what its dd defines.

+6
source

As I just found out, it's a good time to use dt without dfn for metadata. Here is an example that was right under my nose in the same list of definition lists :

<dl> also suitable for marking up content metadata, such as information about our article on how to use HTML5 in your work with the client right now.

Here is the markup:

 <dl> <dt>Authors:</dt> <dd>Remy Sharp</dd> <dd>Rich Clark</dd> <dt>Editor:</dt> <dd>Brandan Lennox</dd> <dt>Category:</dt> <dd>Comment</dd> </dl> 

(A little criticism of this example: ":" is indicated as part of the term, but it is actually used as a delimiter.)

+2
source

No one has covered this, from the original blog to this publication. The reason is that:

 <dl> <dt><dfn>RSS</dfn> flibbit </dt> <dd>An XML format for ...</dd> </dl> 

You can add non-verbal wording to <dt> , so CSS marks it as a specific side, not a specific side of the data.

This pair with the <dfn> rule should appear once per <dl> (otherwise, someone scanning it might be confused).

+1
source

Source: https://habr.com/ru/post/918252/


All Articles