Click here to Skip to main content
15,513,143 members
Articles / Web Development / CSS3
Alternative
Tip/Trick
Posted 5 Mar 2011

Tagged as

Stats

30.1K views
3 bookmarked

Remove blue border when image is inside the hyperlink

Rate me:
Please Sign up or sign in to vote.
4.68/5 (13 votes)
18 Aug 2011CPOL
DescriptionY...

Description


Your way is for all images. If you want to remove border for selected images, then you can set the border style to inline for the particular image.

Code

Method 1
XML
<a href="http://www.codeproject.com"><img src="Bob.gif" alt="Codeproject" style="border-style: none;" /></a>
Method 2
XML
<a href="http://www.codeproject.com"><img src="Bob.gif" alt="Codeproject" border="0" /></a>

Browser Compatibility


I have tested this script in the following Web browsers:

  • Internet Explorer
  • Mozilla Firefox
  • Google Chrome
  • Safari
  • Opera

Result


<img src="http://s.codeproject.com/App_Themes/Std/Img/logo225x90.gif" style="border-style: none;" title="Image without border">

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Questionwhat about imagamaps? Pin
jan lucas5-Feb-14 6:54
jan lucas5-Feb-14 6:54 
AnswerRe: what about imagamaps? Pin
thatraja5-Feb-14 16:39
professionalthatraja5-Feb-14 16:39 
GeneralRe: what about imagamaps? Pin
jan lucas6-Feb-14 6:49
jan lucas6-Feb-14 6:49 
GeneralMy vote of 5 Pin
Farhan Ghumra28-Jun-12 2:35
professionalFarhan Ghumra28-Jun-12 2:35 
GeneralReason for my vote of 5 Good but it is always advisable to u... Pin
Kunal Chowdhury «IN»5-Apr-11 19:39
professionalKunal Chowdhury «IN»5-Apr-11 19:39 
GeneralRe: Agree Kunal but it's just an alternate way, that's all. Pin
thatraja6-Apr-11 1:02
professionalthatraja6-Apr-11 1:02 
GeneralRe: I think it's easier to illustrate it in a tip as an inline s... Pin
jlafay23-Aug-11 4:17
jlafay23-Aug-11 4:17 
GeneralReason for my vote of 5 Because it is simple and really work... Pin
kunal_shivalkar29-Mar-11 4:46
kunal_shivalkar29-Mar-11 4:46 
GeneralReason for my vote of 2 inline styles are bad Pin
Seishin#25-Mar-11 14:46
Seishin#25-Mar-11 14:46 
GeneralRe: Well it's just an alternate way. Also it will effect for sel... Pin
thatraja25-Mar-11 16:44
professionalthatraja25-Mar-11 16:44 
GeneralReason for my vote of 5 It works and thus my 5, but I'd stil... Pin
Manfred Rudolf Bihy7-Mar-11 9:12
professionalManfred Rudolf Bihy7-Mar-11 9:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.