小编xhf*_*015的帖子

Why does padding-top + object-fit not work on images?

I want to make the image a responsive square. Therefore, we decided to absolutely arrange the image by specifying padding-top: 100% as the pseudo element of the parent element of the image. We thought that if we applied object-fit: cover to the image, the image would be square.

However, in fact, images that do not have enough width and height are not magnified, and it seems that object-fit is not working.

How can I create a responsive square with CSS …

html css twitter-bootstrap bootstrap-4

1
推荐指数
1
解决办法
61
查看次数

标签 统计

bootstrap-4 ×1

css ×1

html ×1

twitter-bootstrap ×1