See all Insights

How to create a link in html

To create a link within your website
This is the code you need if you are trying to link to a page that is on your site.
<a href=”page2.html”>This is a link</a>

Example: This is a link to “newfangled_employee_blogs”

Linking to an external site.

To make a link that that redirects to an external site, the href must begin with http://

<a href=”http://cnn.com” >Link to CNN</a>

 

Example: This is a link to an external site

Link that opens up in either a new window or new tab.
This is the code you need to make a link open up in a new window or a new tab depending on what browser you are using.
<a href=”page2.html” target=”_blank”>This is a link that opens up in either a new window or new tab</a>

Example: This is a link that opens up in a new window / tab

How to make a link that opens up in a new window (popup).

To make a link open up in a new window (popup), here is the code.

<a target=”_blank” onclick=”window.open (‘page2.html’,’_blank’, ‘status=1, toolbar=0, location=0, menubar=0, resizable=1, left=20, top=50, width=90, height=90’);
return false;” href=”#”>Test Popup 3</a>

Example:
This is a popup link

Here is some of the optional stuff that one can specify for the new window by either specifying 0 or 1.
Please note: In programming, “0” means false, “1” means true.

toolbar=0 hide/show the toolbar
status=1 hide / show the status bar
location=0 hide/show the address/location bar
menubar=1 hide/show the menu bar
resizable=0 is the popup window resizeable
left=200 position the popup 200 pixels from the left
top=250 position the popup 250 pixels from the top
width=300 width of the popup
height=400 height of the popup

If you are specifying more than one item, you must separate each item by a comma (as shown in the example above).

Related Posts