HTML Guide
The <dl>
element, used to create a definition lists that matches some terms with their definitions, has nesting issues related to <div>
elements used with it.
Learn more:
Related W3C validator issues
The <dl> element is used in HTML to represent a description list. The element encloses a list of groups of terms (specified using the <dt> element) and descriptions (provided by <dd> elements). Common uses for this element are to implement a glossary or to display metadata (a list of key-value pairs).
For example, the following is a description list with a single term and its definition:
<dl>
<dt>Rocket Validator</dt>
<dd>
The fastest site-wide HTML and Accessibility checker.
</dd>
</dl>
Description lists also allow to specify different terms for the same definition, as in this example:
<dl>
<dt>Rocket Validator</dt>
<dt>Rocket</dt>
<dt>RV</dt>
<dd>
The fastest site-wide HTML and Accessibility checker.
</dd>
</dl>
Or, we can have a single term with multiple definitions:
<dl>
<dt>Rocket Validator</dt>
<dd>
The fastest site-wide HTML and Accessibility checker.
</dd>
<dd>
The web site you're browsing right now.
</dd>
</dl>
In all of these cases, a <dt> term always requires one (or more) <dd> definition elements, so the following is invalid because it’s incomplete, it has an undefined term:
<dl>
<dt>The Meaning of Life</dt>
</dl>
The rel attribute defines the relationship between a linked resource and the current document. Valid on <link>, <a>, <area>, and <form>, the supported values depend on the element on which the attribute is found.
Here’s an example of using the rel attribute to link a document to a CSS stylesheet:
<link rel="stylesheet" href="default.css" />
Here’s an example os using the rel attribute to tell search engine spiders to ignore the link relationship with another document:
<a href="https://example.com" rel="nofollow">more info</a>
Using aria-required on a div element requires more context about that element, by providing one of the attributes aria-expanded, aria-valuemax, aria-valuemin, aria-valuenow, role.
When possible, you should prefer semantic tags like input, select and textarea, and use the required attribute, but when form controls are created using non-semantic elements, such as a div element, the aria-required attribute should be included with a value of true to indicate to assistive technologies that user input is required on the element for the form to be submittable. In that case, other attributes might be needed to make the element valid.
For example, we could build a radiogroup using a div like this:
<div aria-required="true">
<div data-value="One"></div> 1
<div data-value="Two"></div> 2
<div data-value="Three"></div> 3
</div>
This HTML snippet would then be decorated using CSS and added functionality using JavaScript. However, the W3C validator will complain that the element div is missing one of the attributes aria-expanded, aria-valuemax, aria-valuemin, aria-valuenow, role.
We can fix that by adding the appropiate role to that div element, like this:
<div aria-required="true" role="radiogroup">
<div data-value="One"></div> 1
<div data-value="Two"></div> 2
<div data-value="Three"></div> 3
</div>
Here is an example showing how to add the “role” attribute to the “div” element:
<div role="region">
<!-- Your content goes here -->
</div>
In this example, the role attribute is added with the value radiogroup. You can choose the appropriate ARIA role based on the purpose or role of your div element.
Remember to also provide the necessary values for the specified attributes if you are adding aria-valuemax, aria-valuemin, or aria-valuenow to ensure proper accessibility and usability of your content.
A <div> tag has been found as a direct child of an <ul> tag, and this is not allowed. For example, <ul><div><li>item</li></div></ul> is not valid, but <ul><li><div>item</div></li></ul> is valid as the direct child of <ul> is <li>.
The <dl> element, used to create a definition lists that matches some terms with their definitions, is missing a required child element.
The following list will cause this issue, as it’s missing a <dt> to specify the term the given definition refers to:
<dl>
<dd>A box without hinges, key, or lid, yet golden treasure inside is hid.</dd>
</dl>
Fixing the above example is as easy as including the missing <dt> with the term:
<dl>
<dt>Egg</dt>
<dd>A box without hinges, key, or lid, yet golden treasure inside is hid.</dd>
</dl>