border in a image link

S

signo

Hello to everybody,
I'm trying to display a border when the mouse passes over an image that
has a link.
With IE6 everything is Ok, but with Mozilla only a portion of the
border is shown.
Does anybody know the reason why?
Thanks.

<STYLE type=text/css>
#nav A:hover {border:5px solid black}
</STYLE>

<div id="nav">
<a href="http://www.indirizzo.html">
<img src="mia_immagine.jpg">
</a>
</div>
 
E

Els

signo said:
With IE6 everything is Ok, but with Mozilla only a portion of the
border is shown.
#nav A:hover {border:5px solid black}

It's because you are placing a border on the <a> element, instead of
on the image.
Change your style rule to:
#nav A:hover img {border:5px solid black}
 
S

Sid Ismail

On 25 Oct 2005 04:07:44 -0700, "signo" <[email protected]>
wrote:

: Hello to everybody,
: I'm trying to display a border when the mouse passes over an image that
: has a link.
: With IE6 everything is Ok, but with Mozilla only a portion of the
: border is shown.
: Does anybody know the reason why?
: Thanks.
:
: <STYLE type=text/css>
: #nav A:hover {border:5px solid black}
: </STYLE>
:
: <div id="nav">
: <a href="http://www.indirizzo.html">
: <img src="mia_immagine.jpg">
: </a>
: </div>
:


Tr adding padding:3px in the style declaration

Sid
 
S

signo

I've found a solution: in this way it works well:

<style type="text/css">
#nav a {padding:5px; border:none; display:block; float:left}
#nav a:hover {padding:0; border:5px solid black}
#nav a img {border:none; display:block; margin:0}
</style>

<div id="nav">
<a href="http://www.indirizzo.html">
<img src="mia_immagine.jpg" /><span>Vai a indirizzo.html</span>
</div>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top