1. Home
  2. Computing & Technology
  3. Web Design / HTML

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">
Explore Web Design / HTML
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. HTML and XHTML
  5. Beginning HTML Tutorials
  6. How can I turn off the border on linked images?>

©2010 About.com, a part of The New York Times Company.

All rights reserved.