Crop image in CSS

后端 未结 8 610
情书的邮戳
情书的邮戳 2021-01-12 07:23

I\'ve created a two-column grid of images, which works fine with all-landscape images: Link. However, I\'ve added a portrait image that throws off the layout, so I\'d like t

8条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-12 08:09

    I'm not sure what I'm doing wrong. Any help would be appreciated.

    Your problem is on CSS selectors.

    img.portrait-crop
    {
        margin-bottom: -30px;
    }
    

    matches an image with portrait-crop class.

    but this

    .portrait-crop img
    {
        margin-bottom: -30px;
    }
    

    Matches an image inside a protrait-crop container.

提交回复
热议问题