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
Related
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.
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="ar">
<body>
<p>بيـــان أعـــرف عميــــــلك</p>
</body>
</html>
I am getting this as my result : بيـــان أعـــر٠عميــــــلك
Can anyone help me?
Strangely, I can't repeat your results in my browser. Where do you get your results?
However, I think what Xufox suggests is a good practice, to set charset as utf-8 in you meta tag in header.
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="ar">
<head>
<meta charset="utf-8"/>
</head>
<body>
<p>بيـــان أعـــرف عميــــــلك</p>
</body>
</html>
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!
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
I can't believe what is happening in my website. When I add this line:
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html>
<html>
<head>
Everything works fine. And when I don't, CSS "messes" up, everything becomes different and layout becomes "ugly".
How can this line solve all the problems?!
You're mixing up HTML with XHTML.
Usually a <!DOCTYPE> declaration is used to distinguish between versions of HTMLish languages (in this case, HTML or XHTML).
Different markup languages will behave differently. My favorite example is height:100%. Look at the following in a browser:
XHTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
table { height:100%;background:yellow; }
</style>
</head>
<body>
<table>
<tbody>
<tr><td>How tall is this?</td></tr>
</tbody>
</table>
</body>
</html>
... and compare it to the following: (note the conspicuous lack of a <!DOCTYPE> declaration)
HTML (quirks mode)
<html>
<head>
<style type="text/css">
table { height:100%;background:yellow; }
</style>
</head>
<body>
<table>
<tbody>
<tr><td>How tall is this?</td></tr>
</tbody>
</table>
</body>
</html>
You'll notice that the height of the table is drastically different, and the only difference between the 2 documents is the type of markup!
That's nice... now, what does <html xmlns="http://www.w3.org/1999/xhtml"> do?
That doesn't answer your question though. Technically, the xmlns attribute is used by the root element of an XHTML document: (according to Wikipedia)
The root element of an XHTML document must be html, and must contain an xmlns attribute to associate it with the XHTML namespace.
You see, it's important to understand that XHTML isn't HTML but XML - a very different creature. (ok, a kind of different creature) The xmlns attribute is just one of those things the document needs to be valid XML. Why? Because someone working on the standard said so ;) (you can read more about XML namespaces on Wikipedia but I'm omitting that info 'cause it's not actually relevant to your question!)
But then why is <html xmlns="http://www.w3.org/1999/xhtml"> fixing the CSS?
If structuring your document like so... (as you suggest in your comment)
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html>
<html>
<head>
[...]
... is fixing your document, it leads me to believe that you don't know that much about CSS and HTML (no offense!) and that the truth is that without <html xmlns="http://www.w3.org/1999/xhtml"> it's behaving normally and with <html xmlns="http://www.w3.org/1999/xhtml"> it's not - and you just think it is, because you're used to writing invalid HTML and thus working in quirks mode.
The above example I provided is an example of that same problem; most people think height:100% should result in the height of the <table> being the whole window, and that the DOCTYPE is actually breaking their CSS... but that's not really the case; rather, they just don't understand that they need to add a html, body { height:100%; } CSS rule to achieve their desired effect.
Its an XML namespace. It is required when you use XHTML 1.0 or 1.1 doctypes or application/xhtml+xml mimetypes.
You should be using HTML5 doctype, then you don't need it for text/html. Better start from template like this :
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>domcument title</title>
<link rel="stylesheet" href="/stylesheet.css" type="text/css" />
</head>
<body>
<!-- your html content -->
<script src="/script.js"></script>
</body>
</html>
When you have put your Doctype straight - do and validate you html and your css . That usually will sove you layout issues.
It sounds like your site has CSS or JS that depends on running in quirks mode. Which is why you need garbage above your doctype to render "correctly". I suggest removing said garbage and then fixing your CSS+JS to actually work in standards mode; you'll save yourself a lot of pain in the long run.
The namespace name http://www.w3.org/1999/xhtml
is intended for use in various specifications such as:
Recommendations:
XHTML™ 1.0: The Extensible HyperText Markup Language
XHTML Modularization
XHTML 1.1
XHTML Basic
XHTML Print
XHTML+RDFa
Check here for more detail