Hover image - display div over it

前端 未结 5 546
误落风尘
误落风尘 2021-02-03 13:53

On hover I want a link apear at the top-right of the image. Just like on your profile picture on Facebook, where it says \"Change Picture\".

I have tried to to get it wo

5条回答
  •  爱一瞬间的悲伤
    2021-02-03 14:10

    You need to absolute position the link in a container that has position different than the normal flow. In this example I use relative for that on the container. Try this:

    HTML

    
    

    CSS

    .imgHover { float: left; }
    .imgContainer { position: relative; }
    .imgContainer a { display: block; position: absolute; top: 0; right: 0; background: Green;}
    

提交回复
热议问题