I cannot validate this blank page to XHTML 5.1.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>XHTML 5.1 blank page</title>
</head>
<body>
<h1>Blank page</h1>
<p>Text here.</p>
</body>
</html>
All tags are well-closed and I specific the DOCTYPE, what I'm wrong?
You need requires that the attribute indicated should be used. xmlns
And you should look this if you sse the 'lang' or 'xml:lang' attribute to denote the language of the document.
Related
I am trying to validate my document as XHTML 1.0 Transitional (W3C). I have the following error:
"itemscope" is not a member of a group specified for any attribute
Which corresponds to this code:
<body class="innerpage" itemscope itemtype="http://schema.org/Physician">
<body class="innerpage" itemscope itemtype="http://schema.org/Physician">
<!-- Facebook Conversion Code for Leads -->
<script type="text/javascript" src="js/face.js"></script>
</body>
</html>
How can this be solved?
Thanks!
Unfortunately, it is not possible, because http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd knows nothing about those attributes (itemscope, itemtype). You can convince yourself by downloading that file to your computer and trying to find (Ctrl+F) the words itemscope or itemtype within that document. You will get 0 results.
So basically, You’ve got 2 choices starting from here:
If You want to continue using itemscope and itemtype attributes You
have to switch to HTML5 doctype, then your document would look like
as follows:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body class="innerpage" itemscope itemtype="http://schema.org/Physician">
<p>Content</p>
</body>
</html>
This will result in:
This document was successfully checked as HTML5!
If You need to preserve XHTML Document Type Definition, then You have to switch from microdata to RDF and Your document will look the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body class="innerpage" vocab="http://schema.org/" typeof="Physician">
<p>Content</p>
</body>
</html>
This will result in:
This document was successfully checked as -//W3C//DTD XHTML+RDFa 1.1//EN!
Like the title says, what exactly does that mean? Ive tried googling for answers but I still dont understand? so the entire document has to be in a HTML5 format right? and the syntax has to be in strict XHTML?
so is this the correct header to use in this situation? Thank you so much :)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Page Title</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" charset="utf-8"/>
</head>
<body>
</body>
</html>
I think you are looking for polyglot HTML5. It's still HTML, but "could be served" as XML.
This is how the base structure looks like:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>title</title>
</head>
<body>
</body>
</html>
Here is another article: http://www.xmlplease.com/xhtml/xhtml5polyglot/
The normal doctype (see HTML syntax - doctype) for HTML5 is:
<!DOCTYPE html>
You can also use deprecated doctypes, but the term says pretty much everything about them.
And, no, HTML5 markup does not need to be valid XHTML, in the empirical sense that HTML5 markup might be both valid HTML and non-valid XHTML/XML.
Three meaningful considerations are:
in HTML5 <br> is allowed and <br/> is too.
a closing /> on non-void elements does not behave like it does in XML: it's ignored, you cannot have auto-closing entities.
HTML5 introduces a set of so-called semantic tags (nav, footer, article...), that are not specified in XHTML.
Regarding point 2, this is not valid:
<!DOCTYPE html>
<html>
<head><title>Dummy</title></head>
<body>
<div/>
</body>
</html>
you have to write:
<!DOCTYPE html>
<html>
<head><title>Dummy</title></head>
<body>
<div></div>
</body>
</html>
See HTML syntax - elements for more information.
check the required syntax of each element in HTML5 according to web specs
http://w3-video.com/Web_Technologies/HTML5/index.php
provides a syntax section for each element:
e.g.
http://w3-video.com/Web_Technologies/HTML5/doctype/html5_doctype_syntax.php
I am trying to validate my webpages using the W3C validator and it is returning an error whenever I use:
<header>Page Title</header>
The error message it is giving is:
element "header" undefined
I know I can use <h1> instead but was just curious why this isn't accepted?
The doctype you are using (XHTML 1.0 Strict) is incorrect, since the <header> tag is new to HTML 5.
Replace:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
With:
<!DOCTYPE html>
Revalidate, and job's a good'un!
This is a valid markup for me
<!DOCTYPE html> <!-- <-- Watch out for this -->
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Demo</title>
</head>
<body>
<header>
Hello
</header>
</body>
</html>
Make sure you are not using <header> tags as page title, and also you are misunderstanding header with an h1, h1 element is to represent the main header of the page, which represents what type of stuff your page holds, like about us, our services etc, where header tag is used to say that yeah this is my page header which will be rendered on all pages, which generally have nav for navigation/menu, logo, etc
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>
check the documentation on new launched web from W3C at https://www.w3.org/QA/2002/04/valid-dtd-list.html
This is HTML5 Skeleton
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bare Bones HTML5</title>
</head>
<body>
</body>
</html>
If my webpage has some part in Danish and some in English then How I should define the language of the page in HTML?
You can only define one language as the HTML's primary language. There can be only one language (no multiple values) specified for the <html> tag's lang attribute. But you can define a different language for some parts of the page.
For example:
<html lang="en">
...
<p lang="de">Ja, Deutsch.</p>
See the HTML5 spec for further info.
You can define the language in html tag itself.
if you do following :
<!DOCTYPE html>
<html lang = "en">
<head>
<title> ... </title>
</head>
<body>
...
</body>
</html>
in the above markup code you defined "en" or english as your default language for whole document.