Web Hosting Talk







View Full Version : HTML question


Disc13
12-28-2001, 04:30 AM
Hi, I have an image as a link. How do I make the image border to stay a specific color? (like I want the border of the image to remain white. If I add a border to the A HREF tag the border turns blue and purple. If I add a border to to IMG tag, then it turns black. For either way, how can I get it white? Thx!)

Lawrence
12-28-2001, 04:44 AM
Just off the top of my head, and untested, try one of these:

<a href="whatever" style="border: #FFFFFF;"><img src="whatever"></a>

or

<img src="whatever" style="border: #FFFFFF;" border=1>

Disc13
12-28-2001, 04:54 AM
didn't work, thx anyway

Lawrence
12-28-2001, 05:02 AM
Actually, this would make more sense:

<a href="whatever" style="color: #FFFFFF;"><img src="whatever"></a>

If that doesn't work, perhaps if you posted your current code, myself and others could have a play with it and see what works?

Disc13
12-28-2001, 05:09 AM
that's the thing, I don't have current code. All i have is just an A HREF tag and an IMG tag. Thx anyways though.

Bogdan
12-28-2001, 05:22 AM
Make your body tag look like this:

<body bgcolor="#FFFFFF" link="#FFFFFF">

Replace link color with any color that you want you want your border to be.


Proven to work.

Lawrence
12-28-2001, 05:49 AM
Originally posted by Bogdan
Make your body tag look like this:

<body bgcolor="#FFFFFF" link="#FFFFFF">

Replace link color with any color that you want you want your border to be.


Proven to work.


That will work, but it will change all your links to white as well, not just the border around the image. Is that what you want?

If you're just trying to get rid of the border, you can use border=0 in the <IMG> tag as well.

Bogdan
12-28-2001, 06:06 AM
Yes, it will change all the colors of all the links, but that's the only way I could think of doing it at 4am. :sleeping:

Personally, I change the link color from the default 'blue' all the time - it looks much better.

I always use an editor when I design a site, so it's fast to do everything...

- incase you need it:

<a href="/blah.php"><font color="#000000">blah</font></a>

DougBTX
12-28-2001, 08:29 AM
Originally posted by Disc13
Hi, I have an image as a link. How do I make the image border to stay a specific color? (like I want the border of the image to remain white. If I add a border to the A HREF tag the border turns blue and purple. If I add a border to to IMG tag, then it turns black. For either way, how can I get it white? Thx!)

Think simpe!

border=0, imbed the border in the image! (fully graphical browser independant too ;) )

EDIT: Another option:

<table border="0" cellspacing="0" cellpadding="3" bgcolor="#FF0000">
<tr>
<td><a href="#"><img src="imgs/redhatlinux.gif" width="88" height="31" border="0"></a></td>
</tr>
</table>

Advantages of both are that the link colours are not affected, so it does not affect links in the rest of the page..The second is code heavy, but better if you don't want to edit the image. Yet another option is to set up some CSS:



<style type="text/css">
<!--
.bordered { border: 2px solid; border-color: #000066 #FF0000 #009900 #FF9900}
-->
</style>

then later:

<a href="#"><img src="imgs/redhatlinux.gif" width="88" height="31" class="bordered" border="0"></a>



hth,
Douglas

MarcD
12-28-2001, 11:37 AM
do this


<a href="http://yourlink.com" target="_blank"><img src="http://www.yourimage.com/image.jpg" border="3"></a>

and yourborder color will be the link color

change the border size to what u want

greengunboat
12-28-2001, 11:38 AM
put the link, alink, and vlink parameters into the body tag like so:
<body bgcolor="#FFFFFF" link="#FFFFFF" alink="#FFFFFF" vlink="#FFFFFF">

Juan R. Pozo
12-28-2001, 01:01 PM
Try with CSS:

<html>
<head>
<title>Whatever</title>
<style type="text/css">
<!--
body { background : black; color : white }
a:link img, a:visited img { border-color : white }
// -->
</style>
</head>
<body>
<a href="imgborder.html"><img src="fondod.gif" alt="whatever"></a>
</body>
</html>

NN4 might have a problem with this though...