Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Off Topic _ disable hover on a parent but not on img child

Posted by: Fluflu Dec 3 2020, 09:36 AM

Hi smile.gif

I have a <img> inside an <a> link. I am trying to disable my cursor changing when it is on <a> but not when it is on <img>.

Here is my html code :

CODE
<a href="#"class="navbar-brand"><img class="search" src="images/search.png"></a>


Do you know how I could do that?
PS: here is a screen capture of the <a> (delimited by the purple line)


Attached image(s)
Attached Image

Posted by: Christian J Dec 3 2020, 01:42 PM

Since the link only contains an IMG element, how can you see the cursor change over the link but not over IMG? Is it because the link has CSS padding?


Posted by: pandy Dec 3 2020, 03:31 PM

Must be.

You need to remove the hand pointer from the link and then add it to the image. Something like so.

CODE
.nohover   { cursor: default }
.nohover img   { cursor: pointer }


HTML
<a href="" class="nohover">Blah blah<img src="whatever.jpg"></a>

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)