What html version is code snippet below?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="Generator" content="some info here ..." />
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
Lets go line by line
<!DOCTYPE html> - HTML5 Doctype
<html xmlns="http://www.w3.org/1999/xhtml"> - Refer here
<head> - Document head element
<meta name="Generator" content="some info here ..." /> Description of the program you used to create the HTML document
<meta charset="utf-8" /> - Document Character Encoding, Good read
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> Read Here And Here
I would've certainly wrote a big fat description for each but realized that these were already asked in different questions, so thought to link them instead of repeating the same thing here again.
The code snippet is mostly the start of an HTML5 document in XHTML (XML) serialization, sometimes confusingly called XHTML5.
It is not a conforming document, however; the current HTML5 CR does not allow the attribute http-equiv="X-UA-Compatible" (on rather formal grounds, but still).
The doctype belongs to HTML5 Doctype definition.
So the rest of the document should be bases on HTML5
Related
I have two rmarkdown generate html reports.
The first one (rmarkdown version 1.10, pandoc version 2.7.1)with R is working fine
The second one (rmarkdown version 2.2, pandoc version 2.7.1) had black diamond with questions marks show up in places with html characters.
I compared the two documents, and it seems that the only differences are in the headings of the html document.
In the first document, the heading is as following
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
In the second document, the heading is as following
<html>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
I am opening both with Chrome. Can someone help explain why this might be happending?
Thank you!
I have at the start of the HTML Template:
<!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">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=300, initial-scale=1.0, target-densitydpi=device-dpi">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="format-detection" content="telephone=no" /> <!-- disable auto telephone linking in iOS -->
<head>....
However, when it comes to old email clients, my HTML doesnt render at all, and is blank... I have tested this on litmus.
Is there something that I need to add or remove from above so that it also renders in the old browsers as well.
Thanks
Your meta tags should be inside the <head>.
What you have there otherwise looks fine, so it may have something to do with the rest of your document. I would recommend starting with Sean Powell's email boilerplate and bringing some of your code over.
Failing that, have you forgotten to close any elements such as tables/rows/cells?
Which email clients is it broken in?
We are looking at migrating over pages written in HTML 4.01 to HTML5 and am looking at the minimum requirements when including meta tags in the <head> element. For example, my current page which is HTML 4.01 compliant has the following meta tags:
<meta name="description" content="">
<meta name="keywords" content="">
<meta http-equiv="title" content="">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="created" content="2014-02-03T10:10:27.000-04:00">
<meta http-equiv="modified" content="2014-04-01T14:18:21.631-03:00">
<meta http-equiv="language" content="en">
<meta http-equiv="coverage" content="">
<meta http-equiv="publisher" content="">
My question is which one shoud be changed or removed and any other meta tag(s) need to be included.
There are no required meta elements (with one exception, see below).
You can’t use just any metadata name (name) or pragma directive (http-equiv) like it was case in HTML 4.01. In HTML5, all values must be defined/registered in a certain manner.
So you’d have to check the spec and the wiki for possible values. If a value is not listed, don’t use it (or, if you are sure about it, register it).
Exception: there is a meta element that is sometimes required
Only if you don’t specify the character encoding in a different manner (e.g. in the Content-Type HTTP header), you must use a meta element for specifying it. See Specifying the document's character encoding.
If you use UTF-8, just add the following meta element (ideally as the first child element of head):
<meta charset="utf-8">
I am looking at migrating over pages written in XHTML 1.0 to HTML 5 and am looking at the minimum requirements when including meta tags in the <head> element. For example, my current page which is XHTML 1.0 compliant has the following meta tags
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="content-language" content="en-us" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="copyright" content="© 2012" />
<meta name="robot" content="noindex, nofollow" />
Are the following sufficient for HTML 5 and can I also include them?
It is also my understanding that the meta element <meta http-equiv="content-language" content="en-us" /> can now be globally be applied to the <html> element.
<html lang="en-us">
<head>
<meta charset="UTF-8" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="copyright" content="©" />
<meta name="robot" content="noindex, nofollow" />
<title>sample code</title>
</head>
</html>
There is no such thing as minimum meta tags (unless of course I got your question wrong). As far as I am aware no meta tag is required and the ones you add are the ones for your specific needs.
Consider the following document:
<!DOCTYPE HTML>
<html>
<head>
<title>Some Title</title>
</head>
<body>
</body>
</html>
You can validate it and not get any warning whatsoever. The validator just reminds you that the default encoding is missing. This is not even a warning, just an information.
The working draft has this to say about meta tags:
The meta element represents various kinds of metadata that cannot be expressed using the title, base, link, style, and script elements.
And it goes on:
4.2.5.1 Standard metadata names
application-name, author, description, generator, keywords
Further it mentions some additional tags concerning a page's status, contextual representation and character encoding.
Although none of these ar explicitly required by the standard, there are in fact best practices, especially concerning search engine optimization (SEO). This has nothing to do with the HTML standard but with web (search) crawlers.
You can get some good advice which meta tags matter (for Google) at the Webmaster Tools meta tag support page
According to http://validator.w3.org/ the following is an absolutely minimal example of a valid HTML5 document, literally everything else is optional.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Valid HTML5 Document!</title>
</head>
</html>
So, you absolutely must have the charset meta tag defined, and everything else is a matter of accomplishing your goals (search engine related stuff, cache control, etc).
No meta tag is required by any HTML5 draft. (HTML5 is work in progress and may change at any moment without prior notice.)
Many of the tags you list, including the one with content-language, aren’t even allowed (conforming) according to HTML5 drafts. In practice, most of them are useless, but some of them are actively harmful (such as the one that excludes robots, and in most cases those that try to prevent all caching).
Your latter fragment of code is invalid: the html element must contain all other elements, and the head element must contain a title element (in all HTML versions).
Consult the newest W3C HTML5 draft and use the experimental checker http://validator.nu.
When I paste in the url of my page on Facebook, it doesn't pick the title etc.
I've got this in the head:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
<meta property="og:title" content="Baten 2012">
<meta property="og:type" content="website" >
<meta property="og:image" content="http://www.nygeneration.se/båten/img/fb.jpg">
<meta property="og:url" content="http://www.nygeneration.se/båten/"/>
<meta property="og:description" content="Jesus. 2000 ungdomar. EN STÖRT. STOR. BÅT.">
But it doesn't work. Facebook's url debugger says that the url and title aren't declared, but as far as I know they are. What am I missing here? The page in question is here.
Interesting fact by the way is that if I serve the page from the Public folder of my Dropbox it does work.
The problem I've seen is that the sharer.php cache everything really hard so it could be a little bit hard coding as "try/trial and error". I create meta tags from code-behind/serverside and in the end of links for urls and images I add ?v=DATETIME so the result will be like; ../image.jpg?v=20120217120412,.. works like a charm!
the meta tags look good, I do not use the extra xmlns:xx i the html tag, works anyway
You should close all meta tags with />
the <html> also missing.
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="https://www.facebook.com/2008/fbml">
at the top of page use
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
instead of
<!DOCTYPE html>