The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> disable hover on a parent but not on img child
Fluflu
post Dec 3 2020, 09:36 AM
Post #1





Group: Members
Posts: 1
Joined: 3-December 20
Member No.: 27,667



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)

This post has been edited by Fluflu: Dec 3 2020, 09:37 AM


Attached image(s)
Attached Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Dec 3 2020, 01:42 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



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?

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Dec 3 2020, 03:31 PM
Post #3


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



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>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 04:14 AM