Friday, 22 June 2012

How to turn images to Hyperlinks

You can turn images into hyperlinks. The only thing you need to do is surround your image with an A HREF tag. Like this:

<A HREF="pages/about.html">

<IMG SRC="nav_icon.gif"> About this site

</A>

The result would be this, in the Firefox web browser:

Image icons used with hyperlinks

However, Internet Explorer will display the icon like this:

Internet Explorer and image icons used with hyperlinks

The icons now have a blue rectangle around them. This is because they are hyperlinks first and images second. To get rid of the blue rectangle you can add this to the IMG tag:

<A HREF="pages/about.html">

<IMG SRC="nav_icon.gif" BORDER="0"> About this site

</A>

So we've set the BORDER attribute to zero. This gets rid of the blue rectangle in Internet Explorer.

No comments:

Post a Comment