Enlarging images with CSS (or jQuery) without moving everything else on the page

前端 未结 6 1830
暖寄归人
暖寄归人 2021-01-05 19:28

I have a dynamically generated set of images (with a comment near every image). I want to display every image with max-width and max-height of 48 px, but when the user is ho

6条回答
  •  生来不讨喜
    2021-01-05 20:24

    Add a class="userpic-container" to the parent div of the image and try this CSS:

    .userpic-container {
        position: relative;
        height: 48px;
        width: 48px;
    }
    
    .userpic, .commentpic {
        border-radius: 5px;
        position: absolute;
        height: 48px;
        width: 48px;
        z-index: 1;
    }
    .commentpic:hover {
        height: 200px;
        width: 200px;
        z-index: 10;
    }
    

提交回复
热议问题