Someone posted an html/css question the other day and I answered it by directly referencing a piece of code found on w3.org.
I know I found exactly the answer the OP was looking for, and since my answer was taken from a reliable source I didn't test it or check it for errors.
The code I pasted was for how to generate dot leaders, and this is the markup:
<ul class=leaders>
<li><span>Salmon Ravioli</span>
<span>7.95</span>
<li><span>Fried Calamari</span>
<span>8.95</span>
<li><span>Almond Prawn Cocktail</span>
<span>7.95</span>
<li><span>Bruschetta</span>
<span>5.25</span>
<li><span>Margherita Pizza</span>
<span>10.95</span>
</ul>
At a quick glance, the markup looks fine, but if you look closer you'll notice that there is no closing list element </li>
tag anywhere. Another user pointed this out and edited my answer.
I found this to be peculiar, given the fact that I had never seen such formatting (for li
) but on the other hand the code was taken from no else than the World Wide Web Consortium. So I googled it and found that the closing </li>
tag is actually optional.
An li element's end tag may be omitted if the li element is immediately followed by another li element or if there is no more content in the parent element.
So my question here is, which would be the right/best format of this code for an answer here on Stackoverflow? Should the conventional ways of markup-formatting be upheld or should quoted information from reliable sources always remain unedited?
</li>
is optional. This way there is more to learn from the answer.<script>
and<template>
elements may be children of<ul>
or<ol>
. You can roll it back if you want.@Editor'sDisplayName
in the comments under the post. There won't be name autocompletion, but they will receive a notification. This doesn't work for rejected edit suggestions. The editor actually has to be in the edit history.ul
. hmm...