如何在平板電腦和 iPad 上自動調整影像大小以獲得更好的性能
我需要更好的 css 幫助,以便在平板電腦和 iPad 上訪問時自動調整影像大小
.photo {
border-radius: 50%;
width: 20px;
height: 20px;
border: 2px solid #8e9681;
padding: 5px;
}
uj5u.com熱心網友回復:
嘗試使用“%”而不是“px”,因為它會根據螢屏解析度進行相應調整。
uj5u.com熱心網友回復:
把你的影像放在一個 img 容器中,比如
<div class="img-container">
<img class="img" src="" />
</div>
css
.img-container{
width:100px;
height:100px;
overflow: hidden;
}
.img{
max-width:100%;
}
通過這樣做,您可以實作回應式 img
uj5u.com熱心網友回復:
如果您使用 Bootstrap,請閱讀檔案!
Bootstrap 中的影像回應.img-fluid. max-width: 100%;并height: auto;應用于影像,以便它與父元素一起縮放!
有關更多資訊,請參閱:https : //getbootstrap.com/docs/4.0/content/images/
uj5u.com熱心網友回復:
如果答案這么簡單
max-width: 100%
否則,請使用影像和作業代碼更清楚你想要什么。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/337335.html
標籤:html css 推特引导 bootstrap-4
