How can I target the img tag inside an href tag to set focus on the <img>
element?
For example:
<a href="#"><img class="img1" src="abc.png"/></a>
The CSS selector a .img1:focus {}
does not seem to work. I am unable to access the <img>
element inside an <a href></a>
tag.
If I add a class to the img tag, I can apply focus to it, but the img and a tags are different sizes causing issues. For example, using
<a href="#" class="test"><img class="img1" src="abc.png"/></a>
, then a.test:focus{}
works, but I specifically need focus for the img tag.