We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
题目:
请使用纯 CSS 实现图片等比缩放最大化匹配父容器尺寸的效果:使下面的图片自适应填充父容器尺寸,同时保持宽高比。
要求:
效果图:
.box { width: 300px; height: 200px; padding: 10px; border: 1px solid #ccc; }
<div class="box"> <img src="https://fezaoduke.github.io/fe-practice-hard/assets/pics/cartoon.png"> </div>
参考答案:
.box > img { width: 100%; height: 100%; object-fit: contain; }
拓展阅读:object-fit
The text was updated successfully, but these errors were encountered:
No branches or pull requests
题目:
请使用纯 CSS 实现图片等比缩放最大化匹配父容器尺寸的效果:使下面的图片自适应填充父容器尺寸,同时保持宽高比。
要求:
效果图:
参考答案:
The text was updated successfully, but these errors were encountered: