5 ms·
This webpage which is a guide to hand coding things appears to not have a closing </head>, </body>, or </html> tag.
by redmagic 6y ago
This webpage which is a guide to hand coding things appears to not have a closing </head>, </body>, or </html> tag.
- redmagic 6y agoThat being said, I very much like the spirit of the document. Many many good points.
- detaro 6y agoThat is completely valid HTML5. https://html5.validator.nu/?doc=https%3A%2F%2Fmeiert.com%2Fen%2Fblog%2Fminimal-web-development%2F https://html5.validator.nu/?doc=https%3A%2F%2Fmeiert.com%2Fe...
- cringepirate 6y agoThat maybe but it differs from what is shown in the inspector (which shows the <head> and <body> tags). This could be confusing as the source html doesn't match how the browser interprets it.
- giantrobot 6y agoWeb inspectors are showing a representation of the DOM, they are not showing the raw source. Netscape and IE used to have "Show Source" functions that literally showed just the page source. Inspectors will do things like display colors as their RGB triples i.e. rgb(x, y, z) in computed styles when a color has been defined in the HTML like in a body tag or table cell's bgcolor attribute.
- recursive 6y agoAll browsers still have show source. It's just not usually that useful anymore.
- cringepirate 6y agoYes I am aware. It can be confusing if you are new. I had someone ask me why it was different the other day.
- jrumbut 6y agoI usually look at the network log for that information now.
- saagarjha 6y agoJust because it is valid does not mean you should do it.
- recursive 6y agoThat's true. The reasons to do it are in the article.
- redmagic 6y agoTIL!
- mfontani 6y agoAnd yet, it validates - https://validator.w3.org/nu/?doc=https%3A%2F%2Fmeiert.com%2Fen%2Fblog%2Fminimal-web-development%2F https://validator.w3.org/nu/?doc=https%3A%2F%2Fmeiert.com%2F... Neither of the three tags you've mentioned are required anymore in HTML5.
- currysausage 6y agoThey weren’t required before HTML 5 either.
- brainlessdev 6y agoThe author mentions something about omitting HTML tags and links to another article of his own, which could explain this (I haven't read it yet): https://meiert.com/en/blog/optional-html/ https://meiert.com/en/blog/optional-html/
- enriquto 6y agoYou do not even need the opening tags for a correct HTML5
- rimliu 6y agoIt was the case in previous versions of HTML too. Here is my minimal document from 2005: http://rimantas.com/bits/minimal_html.html http://rimantas.com/bits/minimal_html.html
- recursive 6y agoYour tone suggests that you think this is inconsistent. However, I think it's evidence the author read the specifications as recommended.
- spenczar5 6y agoOthers have pointed out that this validates with automated tools. Here's the parts of the spec: - "An html element's end tag can be omitted if the html element is not immediately followed by a comment." https://html.spec.whatwg.org/multipage/semantics.html#the-html-element https://html.spec.whatwg.org/multipage/semantics.html#the-ht... - "A head element's end tag can be omitted if the head element is not immediately followed by ASCII whitespace or a comment." https://html.spec.whatwg.org/multipage/semantics.html#the-head-element https://html.spec.whatwg.org/multipage/semantics.html#the-he... - "A body element's end tag can be omitted if the body element is not immediately followed by a comment." https://html.spec.whatwg.org/multipage/sections.html#the-body-element https://html.spec.whatwg.org/multipage/sections.html#the-bod...
- jimsmart 6y agoPersonally, I prefer to close all of my elements, it avoids having to worry about accidentally triggering one of these hard-to-spot edge-cases.