Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need black border on image link (not default blue) 1

Status
Not open for further replies.

goanna25

Programmer
Feb 24, 2003
4
NZ
I have images that I've specified a border of 1 for but as they are links I get the ugly blue border on them. I'm sure it is something simple maybe in CSS to fix this. Please help.

Thanks!
 
<img src=&quot;imf.gif&quot; style=&quot;border-style:solid;border-color:black;border-size:3px;&quot;> _________________________________________________________
for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
onpnt2.gif
 
Thanks.. but how can I have this apply to numerous images without applying to every image on the site...and not using style=
 
create a class for it in a .css file

then call the class name in the tag with class=&quot;img&quot; or some other naming

eg: save as style.css
.img {
border-style:solid;
border-color:black;
border-size:3px;

then import the file with
<link rel=&quot;stylesheet&quot; href=&quot;style.css&quot; type=&quot;text/css&quot;> _________________________________________________________
for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
onpnt2.gif
 
sorry.. I should've said without creating a class either. Thank you for the detailed info tho. I've done what I'm trying to do before but can't remember how (and can't remember the site..doh!) I'm sure there is an attribute to add to a: or something like that.
 
it has to be (in the html) just a standard <img src=pic.jpg border=1> tag without styles or classes. The reason being the images will be used within a CMS and the client has to be able to add further images without specifing styles etc.
 
how bout

<img src=pic.jpg border=1 bordercolor=&quot;black&quot;>


but knowing me i prob read it wrong but keep in mind i didn't read it all lol
 
how bout just getting rid of the ugly border all together like this:


<img src=&quot;blah.bmp&quot; border=&quot;no&quot;>

Hope that helps


Code One
 
If you're happy to never have a blue border around an image link (and I'm guessing that, like most of us, you are), put this in your style sheet:

Code:
a img {border-color: black}

Obviously, you can globally specify other border properties too if you want to. -- Chris Hunt
Extra Connections Ltd
 
The default border color is defined in the <BODY> tag for the link and vlink attributes. If you want to change the color without all that CSS, just change what it is in the BODY tag.

However, I feel that not having a border is the best solution (why that isn't the default - ask the WC3?). So I ALWAYS put the attribute border=&quot;0&quot; in my <IMG> tags.

Hope this helps, Einstein47
(&quot;Vision without action is a daydream - Action without vision is a nightmare. Japanese Proverb&quot;)
 
Changing the link and vlink attributes will change the colour of text links as well as border colours. They're also both deprecated in HTML 4.01 in favour of CSS.

I think the thinking behind the coloured border appearing by default is that there should be some visual cue that a particular image is also a link. However, I agree that in the vast majority of cases the nature of the image (e.g. button, advert) or common convention (logo in top-left) makes it obvious. And those blue borders do look horrible... -- Chris Hunt
Extra Connections Ltd
 
I found this forum by searching for the same answer. I think what I can do now is globally avoid the dreaded blue border, with:
a img {border:none;}
a.one:img {border-color:black;} as a class for the link when I want it to have a black border. I tried this and for some reason I am not getting my colored border with <a class=&quot;one&quot; href etc.> I also tried it specifying a.one:img {border:1 pt black solid;} Still not working and not sure what I am doing wrong. I like learning things so any help would be appreciated. This looks like a wonderful forum.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top