Re: validator passed a page with missing tags

Hi Elizabeth—

> I teach web development at a college. A student submitted the page shown at the URL given below. It is missing a closing <head> tag and both <body> tags. Can you explain why the Validator gave it a perfect pass? Attached is a screenshot of the results from the Validator.

some HTML tags are optional (at least under certain conditions), so
this is perfectly valid.

The spec describes this for every element; see e.g. the `p` element at
https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element:
“A p element's end tag can be omitted if…”

An overview over various markup that can be omitted is available at
one of my own pages (which I feel free to share as optional markup is
just something I’m working with—or omitting—a lot):
https://meiert.com/en/blog/optional-html/.

There are different views on the practice, then; you may need to weigh
any pros and cons you find.

Best,

 Jens.

-- 
Jens Oliver Meiert
https://meiert.com/en/

Received on Thursday, 19 September 2019 18:21:11 UTC