What is the difference between a URL and a LINK?

People talk about URL and LINK as if they're different things, but they look the same to the naked eye.

What's the difference between them?


URL is an acronym for "Uniform Resource Locator", and it is the address that specifies the location of a resource on the Internet. A typical URL must specify the protocol used to access the resource, the name of the host computer on which it is located, and the path of the resource: http://www.server.com/main/folder/resource.html The above URL indicates that the document resource.html is located at the web server www.server.com where it can be found in the path /main/folder.

An Hyperlink, or simply a Link, is "An element in an electronic document that links to another place in the same document or to an entirely different document. Typically, you click on the hyperlink to follow the link.

Source


These are some URLs:

  • http://example.com/
  • mailto:alice@example.com
  • https://example.com/all.css
  • In a document, these URLs can be linked. This would, typically, allow consumers to do something with this URL (by clicking on it, or automatically when opening the document, etc.), eg:

  • visiting the page identified by the linked URL
  • sending an email to the linked email address
  • downloading the stylesheet referenced by the link
  • In an HTML document (which is the most popular, but not the only document format that can contain links), you could (for example) use the a element, which creates an hyperlink (aka. link) that can have a label (or anchor text) of your choice, eg:

  • <a href="http://example.com/">This is a link.</a>
    <a href="http://example.com/">http://example.com/</a>
    <a href="http://example.com/">http://example.net/misleading-label</a>

  • <a href="mailto:alice@example.com">email me</a>
    <a href="mailto:alice@example.com">alice@example.com</a>

  • <a href="https://example.com/all.css">A CSS file</a>
    <link href="https://example.com/all.css" rel="stylesheet" />

  • 链接地址: http://www.djcxy.com/p/1898.html

    上一篇: HTML5占位符CSS填充

    下一篇: URL和LINK有什么区别?