1. Computing

Discuss in my forum

How can I turn off the border on linked images?

By , About.com Guide

Question: How can I turn off the border on linked images?

I received the following question from Kerry:

I want to make my logo an active link to my home page on every page, but when it is active it takes on a light colored border, not attractive to my logo. I tried to use CSS to make the active link transparent or black but then it did all my links. any suggestions?
Answer:

One of the biggest frustrations to linking images is that they often end up with an ugly colored border around them - even if there was no border on them before you added the link. This is a function of how Web browsers handle links - most Web browsers want to make links visible, so they make images obvious links by creating a border around the image the same color as the link color for the rest of the document.

To fix this, you need to get rid of the border. You can do this with deprecated HTML or with CSS. I recommend CSS. Just add the border style to your images (or all images if you never want a border around your images):

<img src="image.gif" alt="logo" style="border: none;" />

To turn off the border on all your images, put a line in your style sheet:

img { border: none; }

You can also use the border attribute on the image tag, but this has been deprecated in XHTML and HTML 4.01.

<img src="image.gif" alt="logo" border="0">

©2013 About.com. All rights reserved.