Where Knowledge Rules

Computers & Technology:

Internet

Get a Widget for this title

How to create an image link

How to Create an Image Link

One of the most common forms of navigation in a site these days is the image link logo. Look at Helium for example. If you click the Helium logo it will take you to the home page of the site no matter where you are. In this article it will be assumed you know how to put the basics of a HTML page together and substitute any default values for that of the files/images/text you want in your page.

CREATING THE IMAGE

At first we need an image. If we follow the theme from above we can use the logo or photo you want on your website.

Inside the HTML BODY tag we will add the following line of code:

IMG src='./images/image.jpg' alt='My Logo'

The 'src' attribute of the Image Tag will be the file path on your web hosting server. The './' refers to the root directory and the 'images/image.jpg' means there is a logo/photo called 'images.jpg' in the folder 'images', which is a sub directory off the root of your hosting account. In this case we used a Relative path name based on the location of the web page itself.

The 'alt' attribute is something that is often frowned upon if not used. This helps with accessibility for your site because if an image can't be loaded or you accidentally didn't specify the correct file path then a little box will show up in place of the image with the alternative text. In this case it will say 'My Logo' but you could have it say 'home page' or the name of your company/website.

CREATING THE LINK

To create a link around the image we need to add the following code to the above:

A href='http://www.your-domain.c om'IMG src='./images/image.jpg' alt='My Logo'/A

Now when you refresh your page you will see you can now click the link and it will reload your home page.

The 'href' property holds the URL to your home page, or any other page you might want to link to. In this case it was an Absolute address, which means you provided the whole URL address as compared to the relative address of the image.

FINISHING TOUCHES

In order to make it look really professional we can do a few more things. Firstly I assumed you will wanted the logo in the top left corner of the page, but you can change the alignment properties to suit your needs. To do this we can use the DIV tag as such:

DIV align=centerA href='http://www.your-domain.c om'IMG src='./images/image.jpg' alt='My Logo'/A/DIV

Also you may notice that your linked image has a border around it, which is blue when you haven't clicked it but turns purple when you have. This is the the same as when you click a text link, however most people don't want it around images. In this case will will need to modify the image tag like so:

DIV align=centerA href='http://www.your-domain.c om'IMG src='./images/image.jpg' alt='My Logo' border='0'/A/DIV

By setting the image 'border' attribute to 0 we remove it altogether. There you have it you very own image link logo!

FURTHER INFORMATION

http://www.w3school s.com/HTML/html_links.asp

Learn more about this author, Niamh Brown.
Contact this writer Click here to send this author comments or questions.


Below are the top articles rated and ranked by Helium members on:

How to create an image link

  • 1 of 7

    by Niamh Brown

    How to Create an Image Link

    One of the most common forms of navigation in a site these days is the image link logo. Look

    read more

  • 2 of 7

    by Angel Sosa

    For those out there, creating an image link may not be something of importance; however, look around. On the screen right

    read more

  • 3 of 7

    by Toni Laberge

    Many tools are available when creating a website. You can work in a text editor and write html code, or you can use one

    read more

  • 4 of 7

    by Bruce Bostwick

    Inserting a link to an image isn't as hard as you would think. For starters, you would need to know the basics of HTML.

    read more

  • 5 of 7

    by EMoore

    You create an image link by writing the correct html coding. This basically done by writing the code, the html page and

    read more

View All Articles on:
How to create an image link

Add your voice

Know something about How to create an image link?
We want to hear your view. Write_penWrite now!

Helium Debate

Cast your vote!

Is allowing the commercial creation of new top level domains (TLD) a good idea?

Click for your side.

171851

Featured Partner

Dogs Deserve Better

Dogs Deserve Better has partnered with Helium, giving you the chance to write for a cause. Browse Dogs Deserve B...more

What is Helium? | Buy Web Content | Contact Us | Privacy | User agreement | DMCA | User Tools | Help | Community | Helium’s Official Blog | Link to Helium

Helium, Inc.
200 Brickstone Square Andover, MA 01810 USA