简体   繁体   中英

How do I change the hitbox of an image in CSS?

I made a website where in the beginning, you see an arrow pointing down, so you can click on it to scroll down automatically. I changed the position of the image with padding-left and padding-top to get it into the lower center.

The problem is that the clickable area of the image goes from the top left to the image.

How do I decrease the hitbox?

Thanks in advance

Ps: I did the HTML like this:

<a href="...">
  <img src="..."></img>
</a>

Use margin instead of padding if your layout will tolerate it. Otherwise use box-sizing: border-box .

Here is a good, short read regarding that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM