How do I create a link?

The most important attribute of the element is the href attribute, which indicates the link's destination.

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:

Visit W3Schools.com!

Try it Yourself »

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:

Visit W3Schools!

Try it Yourself »


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

Try it Yourself »



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

Example


How do I create a link?

Try it Yourself »


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


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

HTML Tutorial

Try it Yourself »


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

Enter the appropriate content information (metadata) to check the item into the content server. Much of the information will be automatically provided. If a field name is marked red, then the field is required (that is, the item cannot be checked in if the field is empty). Use the Browse button next to the Primary File field to navigate to the file on your computer and select it. Also, make sure to specify a title.

Click Next when you have finished.

  • Choose the target section for the link. You can choose from the following options:

    • Use default website section metadata: If you choose this option, the hyperlinked content file will display in the Web site section as currently specified in the Web Site Section metadata field for the content file. If the site designer allows contributors to select the URL format of links, you must use an ID-based URL format (see next step).

    • Choose a website section: If you choose this option, the hyperlinked content file will display in the Web site section of your choice (in effect overriding the default target section of the content file). The section may be in the current Web site or another Site Studio site on the content server.

    • Link to the Content Item's URL: If you choose this option, the file will display exactly as it is stored on the content server rather than within the framework of the Web site. This is useful for linking to native documents such as PDF files.

    Click Next to continue.

  • Depending on the site configuration, you may be prompted to choose the URL format of the link:

    • Path-based URL: The link will contain a path to the target location. You have two choices for this type of link:

      • Absolute Path: Generates a full path; for example Menus/switched_region_CDF (where "" gets replaced with the path to the root of the Web site).

      • Relative Path: Generates a relative path instead of a full path; for example ../Menus/switched_region_CDF.

      Please note that this option is not available if you chose to use the default Web site section for the content file as the target section (see previous step).

    • ID-based URL: The link will contain the coded identity of the target location rather than the path-based name. You have three choices for this type of link:

      • Client Side Script Format: Uses client-side JavaScript to construct a link to the target location; for example, javascript:link('switched_region_CDF');.

      • Server Side Script Format: Uses server-side Idoc Script to construct a link to the target location; for example, .

      • URL token format: Uses a redirect on the server to construct a link to the target location; for example, ssLINK/switched_region_CDF.


    Note:

    You may not see the URL format page, depending on whether the site designer chose to allow contributors to make this decision. Ask your site designer for assistance if you are unsure which URL format to pick.

  • Click Options.

    The Link Target Options dialog is displayed.

  • If you want the link to open in a new web browser window when clicked, select the Open link target in new window check box, and then choose the target in the menu (_blank). You can also directly enter the name of the target in the text box if you want, but if it is not a valid target, the link will be faulty.

    On your Android tablet or phone.
    On your Android tablet, tap the Insert tab. On your Android phone, tap the Edit icon. at the top of your screen, tap Home, and then tap Insert..
    Tap Link..
    Enter the text to display and the address of your link..
    Tap Insert..
    Add a link. Tap an object, text box, or selected text you want to turn into a link, then tap Link. to see Link. Tap Link To and choose a link type (Webpage, Email, Phone Number, Page, or Bookmark).
    To make a hyperlink in an HTML page, use the <a> and </a> tags, which are the tags used to define the links. The <a> tag indicates where the hyperlink starts and the </a> tag indicates where it ends. Whatever text gets added inside these tags, will work as a hyperlink. Add the URL for the link in the <a href=” ”>.
    Highlight the text you'd like to turn into a hyperlink, go to Insert in the menu bar, and choose Link. Then simply copy and paste the URL.