Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valid html 5 sample

Tags:

html

I'm looking for an html 5 document in xml format that is considered valid by these tools:

  • eclipse juno html validator
  • w3c validator http://validator.w3.org
  • http://html5.validator.nu/
  • firefox html validator https://addons.mozilla.org/fr/firefox/addon/html-validator/

Can anyone provide me such a document if it exists or explain me which validator aren't conform to the standard. The best I've found is the following document:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
    dir="ltr">
<head>
<meta name="description"
    content="application/xhtml+xml; charset=UTF-8" />
<title>Get an object</title>
</head>
<body>
    <section>This is a section</section>
</body>

Note that document contains a section element which is only valid in html 5. This document isn't valid for eclipse and firefox.

Regards, Mickaël

Answer:

Thanks for your useful link igo: http://docs.webplatform.org/wiki/html/tutorials

I learnt that even if using xhtml syntax is highly recommended, including the xml header line may cause problems to some browsers. So I removed it and the following code is validated by all validators above, eclipse validates it as html5 using xml constraints.

<!DOCTYPE html>
<html lang="en"
    dir="ltr">
<head>
<meta name="description"
    content="application/xhtml+xml"/>
<meta charset="UTF-8"/>

<title>Get an object</title>
</head>
<body>
    <section>This is a section</section>
</body>
</html>
like image 864
mvera Avatar asked Mar 13 '26 15:03

mvera


1 Answers

check the documentation on new launched web from W3C at https://www.w3.org/QA/2002/04/valid-dtd-list.html

like image 84
igo Avatar answered Mar 16 '26 04:03

igo