亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

響應式布局:Safari 上的拉伸圖像

響應式布局:Safari 上的拉伸圖像

Go
慕哥6287543 2023-08-21 16:40:43
這是我的布局。所需的行為是,當我垂直調整窗口大小時,圖像會縮放并保持原始寬高比。我的代碼在除 Safari 之外的所有瀏覽器中都運行良好(您可以通過在不同瀏覽器中嘗試該代碼片段來看到它)。你有解決方案嗎?謝謝 ;).wrap-container{  width: 100%;  display: flex;  justify-content: center;  background-color: yellow;  height: 55vh;}.wrap{  width: 700px;  background-color: aqua;  display: flex;  justify-content: flex-start;  align-items: flex-end;  padding-top: 64px;}.wrap img{    height: 100%;    width: auto;    max-width: 300px;    max-height: 300px;}<div class="wrap-container">  <div class="wrap">    <img src="https://via.placeholder.com/300"/>  </div></div>
查看完整描述

1 回答

?
泛舟湖上清波郎朗

TA貢獻1818條經驗 獲得超3個贊

添加flex: 0;到圖像上


.wrap-container{

  width: 100%;

  display: flex;

  justify-content: center;

  background-color: yellow;

  height: 55vh;

}


.wrap{

  width: 700px;

  background-color: aqua;

  display: flex;

  justify-content: flex-start;

  align-items: flex-end;

  padding-top: 64px;

}


.wrap img{

    height: 100%;

    width: auto;

    flex: 0;

    max-width: 300px;

    max-height: 300px;

}

<div class="wrap-container">

  <div class="wrap">

    <img src="https://via.placeholder.com/300"/>

  </div>

</div>


查看完整回答
反對 回復 2023-08-21
  • 1 回答
  • 0 關注
  • 343 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號