3 ms·
> PS Yes, I know there are some tags that don't need end tags (e.g. <img>) e.g. <p>, <li>, <tr>, <td>. > But that's just messed up. Nah, it's pretty straight
by currysausage 12y ago
> PS Yes, I know there are some tags that don't need end tags (e.g. <img>)
e.g. <p>, <li>, <tr>, <td>.
> But that's just messed up.
Nah, it's pretty straightforward once you wrap your head around it: https://html.spec.whatwg.org/multipage/syntax.html#optional-tags https://html.spec.whatwg.org/multipage/syntax.html#optional-...
> </>
This reminds me of @annevk's XML5 concept: https://annevankesteren.nl/2007/10/xml5 https://annevankesteren.nl/2007/10/xml5
- mikeash 12y ago"A p element's end tag may be omitted if the p element is immediately followed by an address, article, aside, blockquote, details, div, dl, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr, main, menu, nav, ol, p, pre, section, table, or ul, element, or if there is no more content in the parent element and the parent element is an HTML element that is not an a, audio, del, ins, map, noscript, or video element." Quite straightforward indeed.
- currysausage 12y ago> "A p element's end tag may be omitted... practically always except when it obviously makes no sense. If you mean <p>Hello</p><span>World</span>, you obviously can't omit </p>, since the inline <span> would become part of <p>. But why would you write that anyway? When you omit </p> where you shouldn't, the validator will usually tell you. You do validate your HTML, right?