'Visual Studio doesn't like div tags inside dl tags
It seems Visual Studio 2019 (not tested previous versions) doesn't like div tags inside dl.
The code copy-pasted from here (3rd example) inside an HTML page in Visual Studio gives warnings.
The following example illustrates the use of the dl element to mark up metadata of sorts. At the end of the example, one group has two metadata labels ("Authors" and "Editors") and two values ("Robert Rothman" and "Daniel Jackson"). This example also uses the div element around the groups of dt and dd element, to aid with styling.
Please note that my VS2019 is up to date.
What can be done to avoid these specific warnings? And worst, indentation and expand/collapse features are broken
To reproduce:
- Open Visual Studio 2019
- Add a new HTML page
- Copy/Paste code from here (3rd example)
- You'll see all
divtags with warnings and no expand/collapse ondivtags. If you replacedlwithdiveverything is okay then.
If I do the same thing in VSCode, it works just fine.
So, it seems VS2019 doesn't like dl with div tags inside.
Solution 1:[1]
<div> is not an allowed content of <dl>
Permitted content
Either: Zero or more groups each consisting of one or more
<dt>elements followed by one or more<dd>elements, optionally intermixed with<script>and<template>elements. Or: (in WHATWG HTML, W3C HTML 5.2 and later) One or more<div>elements, optionally intermixed with<script>and<template>elements.
src: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl
Solution 2:[2]
Considering the fact the message is "Element 'div' requires end tag" (for <div>) and "End tag is missing start tag" (for </div>), not anyhow related to the <dl>, it's just a bug. The wrong <div> formatting points to a bug as well.
If you want the bug to be fixed, you should probably try reporting the bug in the MicroSoft-acceptable way (not StackOverflow definitely).
Solution 3:[3]
The tag in HTML is used to represent the description list. This tag is used with and tag. So is not an allowed content of
Solution 4:[4]
You can not use
divindlcontent. The Description List element
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | 41686d6564 stands w. Palestine |
| Solution 2 | Dmitry T. |
| Solution 3 | kalyan |
| Solution 4 | Hossein Azizdokht |



