css - 如何避免图像扩展我的 html 宽度和高度
问题描述
我的页面中有一些 position: "absolute" 的 svg 文件,但是每当它们靠近我页面的角落时,它们最终都会扩大我的 Container 元素的宽度(我使用的是 Material UI React),我我尝试在页面容器上使用“maxWidth”:“100vw”,但没有成功,以及prop maxWidth =“lg”和“md”。如果可能的话,我希望 svg 或 img 文件消失在虚无中,而不以任何方式与其外部容器交互https://gyazo.com/9d3d8cf86748ac434700ac0b0ceaf1c6
解决方案
你有没有考虑过做这样的事情?
.container {
/* If for some reason the image doesn't fit, hide the overlap */
overflow: hidden;
}
/* Make image sit within it's container */
img {
height: auto;
width: 100%;
}
推荐阅读
- java - Spring Batch:无法增加身份;嵌套异常是 com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'BATCH_JOB_SEQ'?
- heroku - Heroku 从 NPM 注册表获取 Socket Error / Timeout。什么是好的调试步骤?
- image - 将图像提供给 android 模拟器(在 genymotion 中)以模拟来
- ios - React-native-video:检测模块是否在 Swift 中运行并改变方向
- javascript - 无法使用 puppeteer 获取特定的元素列表
- javascript - 多个选择菜单 onChange 通过 ajax 调用按名称更新特定选择菜单
- python - 从 sites.google.com 请求图像时的身份验证问题
- android - Jetpack 撰写模态抽屉打开手势
- excel - 我正在尝试编写代码来显示我上个月的电子邮件重要值
- wordpress - 最后一个滑块结束后滑块旋转不滚动