Define url in html

Links are found in nearly all web pages. Links allow users to click their way from page to page.

HTML links are hyperlinks.

You can click on a link and jump to another document.

When you move the mouse over a link, the mouse arrow will turn into a little hand.

Note: A link does not have to be text. A link can be an image or any other HTML element!

The link text is the part that will be visible to the reader.

Clicking on the link text, will send the reader to the specified URL address.

Example

This example shows how to create a link to W3Schools.com:

By default, links will appear as follows in all browsers:

  • An unvisited link is underlined and blue
  • A visited link is underlined and purple
  • An active link is underlined and red

Tip: Links can of course be styled with CSS, to get another look!

By default, the linked page will be displayed in the current browser window. To change this, you must specify another target for the link.

The target attribute specifies where to open the linked document.

The target attribute can have one of the following values:

  • _self — Default. Opens the document in the same window/tab as it was clicked
  • _blank — Opens the document in a new window or tab
  • _parent — Opens the document in the parent frame
  • _top — Opens the document in the full body of the window

Example

Use target=»_blank» to open the linked document in a new browser window or tab:

Absolute URLs vs. Relative URLs

Both examples above are using an absolute URL (a full web address) in the href attribute.

A local link (a link to a page within the same website) is specified with a relative URL (without the «https://www» part):

Example

Absolute URLs

W3C

Google

Relative URLs

HTML Images

CSS Tutorial

To use an image as a link, just put the tag inside the tag:

Example

Use mailto: inside the href attribute to create a link that opens the user’s email program (to let them send a new email):

Example

To use an HTML button as a link, you have to add some JavaScript code.

JavaScript allows you to specify what happens at certain events, such as a click of a button:

Example

Tip: Learn more about JavaScript in our JavaScript Tutorial.

The title attribute specifies extra information about an element. The information is most often shown as a tooltip text when the mouse moves over the element.

Источник

Define url in html

HTML documents utilize URLs for specifying hypertext links. The following provides a brief introduction to URLs.

5.1 Uniform Resource Locators (URLs)

Every resource available on the Web — HTML document, image, video clip, program, etc. — has an address that may be encoded by a , or «URL» (defined in [RFC1738]).

  1. The scheme identifying the protocol used to access the resource.
  2. The name of the machine hosting the resource.
  3. The name of the resource itself, given as a path.

Consider the URL that designates the current HTML specification:

http://www.w3.org/TR/WD-html4/cover.html

This URL may be read as follows: Use the HTTP protocol (see [RFC2068]) to transfer the data residing on the machine www.w3.org in the file «/TR/WD-html4/cover.html». Other schemes you may see in HTML documents include «mailto» for email and «ftp» for FTP.

URLs in general are case-sensitive (with the exception of machine names). There may be URLs, or parts of URLs, where case doesn’t matter, but identifying these may not be easy. Users should always consider that URLs are case-sensitive.

5.1.1 Fragment identifiers

Some URLs refer to a location within a resource. As specified in [RFC1808], this kind of URL ends with «#» followed by an anchor identifier (called the «fragment identifier»). For instance, here is a URL pointing to an anchor named section_2 :

http://somesite.com/html/top.html#section_2

5.1.2 Relative URLs

A URL (defined in [RFC1808]) doesn’t contain any protocol or machine information. Its path generally refers to a resource on the same machine as the current document. Relative URLs may contain relative path components («..» means one level up in the hierarchy defined by the path), and may contain fragment identifiers.

As an example of relative URL resolution, assume we have the base URL «http://www.acme.com/support/intro.html». The relative URL in the following markup for a hypertext link:

would expand to the full URL «http://www.acme.com/support/suppliers.html», while the relative URL in the following markup for an image

would expand to the full URL «http://www.acme.com/icons/logo.gif».

5.1.3 URLs in HTML

  • linking to another document or resource, (see the A and LINK elements).
  • linking to an external style sheet or script (see the LINK and SCRIPT elements).
  • images, objects and applets for inclusion in a page, (see the IMG , OBJECT , APPLET and INPUT elements).
  • image maps (see the MAP and AREA elements).
  • form submission (see FORM ).
  • frames (see the FRAME and IFRAME elements).
  • citing an external reference (see the Q , BLOCKQUOTE , INS and DEL elements).
  • referring to metadata conventions describing a document (see the HEAD element).

Additionally, the OBJECT and APPLET elements define attributes that take precedence over the value set by the BASE element. Please consult the definitions of these elements for more information about URL issues specific to them.

Link elements specified by HTTP headers are handled exactly as LINK elements that appear explicitly in a document.

MAILTO URLs

In addition to HTTP URLs, authors might want to include MAILTO URLs (see [RFC1738]) in their documents. MAILTO URLs cause email to be sent to some email address. For instance, the author might create a link that, when activated, causes the user agent to open a mail program with the destination address in the «To:» field.

MAILTO URLs have the following syntax:

User agents may support MAILTO URL extensions that are not yet Internet standards (e.g., appending subject information to a URL with the syntax «?Subject=my%20subject» where any space characters are replaced by «%20»). Some user agents also support «?Cc=email-address«.

Источник

Читайте также:  Многомерный временной ряд python
Оцените статью