Hyperlinks

Creating Links Using "a" tag

Links are used so that users can navigate between the pages on our website.

The a tag is used to create a link. A tags can contain text, images, or other objects, and when clicked, they open other pages.

The path of the page to be linked is specified with the href parameter. While specifying the path, the relative path of the page to be visited should be written according to that page.

In other words, if two pages are in the same place (in the same folder), only the name of the page to be linked is sufficient. If the page to be opened is in subfolders, then the names of the folders should be written with / between them before the file name.

When the text between the code line below and the a tags is clicked, the images.html page is opened. Here, it is assumed that the page with the link and the pictures.html page to which the link is given are in the same folder.

<a href="images.html">Click for images.</a>

If the linked page is in a subfolder, the folder(s) names should be written first, followed by the file name. For example, the following code can be written to link the landscape.jpg image in the images folder.

<a href="images/landscape.jpg">Click for landscape image.</a>

If the linked page is not on our own site but on another site, then the full address (url) of that page, including http:// , must be written.

<a href="http://www.silivriehberi.com">Silivri Directory</a>

Target Parameter

When a link is clicked on our page, the linked page will open instead of the current page. We can use the target parameter to change this.

Target parametresi sayesinde link verilen sayfanın yeni bir tarayıcı penceresinde ya da istenen frame (çerçeve) içinde açılmasını sağlayabiliriz.

Target parametresinin alabileceği değerler şunlardır:

target="_blank": Bağlantının, yeni bir pencerede açılmasını sağlar. 
target="_self": Bağlantının, aynı pencere içerisinde açılmasını sağlar. Target kullanılmadığında olan da budur. 
target="_top": Bağlantının, aynı pencere içerisinde en üstten itibaren açılmasını sağlar. 
target="_parent" : Açılan bağlantının, o anda açık sayfayı oluşturmuş bir ana sayfa ya da frameset varsa onun yerinde açılmasını sağlar. 

target="frame(frame) name" : Allows the link to be opened within the named frame.

Creating Empty Links

Sometimes we want a text or object to look like a link but not go anywhere when clicked. In this case, we can create an empty link by typing # in the href parameter.

<a href="#">Anything</a>

 

html a tag usage, a tag examples, html using target parameter, html link creation

EXERCISES

Creating links using a tag Try It
<p>With the "a" tag, we can link <a href="#">to objects</a>. </p>
<p><a href="#">The href parameter is written the address of the file to be opened when the link is clicked.</a></p>
<p>By setting the href parameter "#", we can create an <a href="#">empty link </a> by typing.</p>
<p><a href="#" target="_blank">The target parameter determines the target frame of the page to be opened</a></p>


COMMENTS




Read 742 times.

Online Users: 704



creating-links-using-a-tag