The difference between two different HTML hyperlinks? (link & html tags)
I've been googling the internet and still can't seem to开发者_C百科 find an answer. I was wondering what the difference is between using something like:
<link rel="profile" href="http://gmpg.org/xfn/11" />
and
<html xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml">
I'm using a HTML5 doctype and would like to keep everything clean. Am I wrong in thinking that these are somehow similar? Thanks!
These two types of links have about nothing in common, other than using HTTP URIs.
The profile
link
element links to another resource (often a web page), which should be relevant to the current page. Some browsers might show this link somehow in the user interface, or interpret it otherwise. Or search machines might use this.For some
rel
values (likerel="stylesheet"
), there are definitions on how to interpret them in the relevant standards, others are only used by human readers.The
xmlns:...
links define an XML namespace prefix (og
orfb
) for the current document, with an URI used simply as identifier for the namespace. This means that you can now use elements in these namespaces, in addition to the normal HTML elements (by prefixing their names withog:
orfb:
).The document at that URI will not be retrieved. The elements will either be already known by the XML processor reading the file, or simply ignored (if this is a simple browser interpreting this as HTML).
This is structural metadata about the current document (or element, in fact, as they are allowed on non-root elements, too, and only apply to the element they are on and its enclosed elements).
For your next question in the comment:
The Dublin Core metadata is information about the content of the current document. I can see no reason to use links (or URIs) here, so in fact neither of them fits. If you would put the metadata in a separate document, you could link to them (using a link
element), but normally you would use a meta
element with a name from the Dublin Core standard. (Inside the head
element, of course.)
xmlns:
is an XML attribute. HTML5 is not XML, so this is a worthless attribute in your document.
精彩评论