Is an HTML5 document a valid one if it doesn't have any of the standard HTML5 elements?

StackOverflow https://stackoverflow.com/questions/22169098

  •  02-06-2023
  •  | 
  •  

Question

I have a generic question about HTML5. I'm interviewing at the moment some front-end developers and all of them claim that they use HTML5. However I don't see any of them using any HTML5 specific semantic elements. There's no header, sections, footer, article etc.

Does this qualify as HTML5 then?

Can anyone help / explain? Thanks!

Was it helpful?

Solution

Just like it's not required to use a table tag in HTML4, you don't have to use the new semantic tags in order to create a valid HTML5 document. If it has a HTML5 doctype at the top, and validates, it's HTML5.

That said, if an interview candidate had HTML5 on their CV and then didn't use semantic tags when given a good opportunity to demonstrate their knowledge, I'd start asking questions. Semantic tags are one of the many important benefits that HTML5 brings, and to just ignore them perhaps shows the candidate was more keen to put buzzwords on their resume than actually learn useful technologies.

OTHER TIPS

Although we are not using any html elements like headers, sections, articles, footers etc.

The document will be referred as HTML5 unless and until you specify the doctype for it as

<!DOCTYPE html> 

The browser will expect it as HTML5 document only. It doesn't throw any error for expecting html5 tags.

You can refer to w3org link for more details.

Any one of the tags? For elements you have named it is possible to make a valid HTML5 web page without using any of them. In fact using them makes things harder because there are lots of rules regarding using header and footer for example in a web page in order to be valid. But not using them when there's a good reason to include them in a page usually means the candidate has some problem with HTML5.

Take a look at http://www.w3.org/TR/html5/sections.html#the-header-element W3 page for more information

From a developer's point of view:

HTML5 does not consist of semantic tags, but semantic tags are the new way to go in developing HTML5. Still HTML5 is an upgraded form of HTML4. It differs in many ways or in less ways then expected. There are some differences that you look for like (again) semantic header, section, footer tags or self closing tags like which in html5 can be (although it validates both ways).

Main point is if it has <!doctype html> or the xhtml version <?xml version="1.0" encoding="UTF-8"?> at the top of the file and if it validates I'dd consider it html5.

You can also read all the differences on w3.org which might give you a better understanding of what to expect.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top