我想讓一張圖片具有回應性,但只到螢屏的特定寬度。比如說,如果用戶從300px的寬度開始放大螢屏,那么圖片應該是回應式的,應該隨著螢屏的寬度而增長。一旦達到1440px的寬度,影像就應該停止適應比例。想象一下以下代碼中的影像
<style>
.left-main {
flex: 30%;
background-color: #ffffff;
}
.icon-position{
margin-top: 200px;
margin-left: 33.195%;
width: 61%;
height: auto;
</style>>
<div class = "left-main"/span>>
<img src="images/Developer_Icon。 svg" class="icon-position" width="178" height="180">
</div>/span>
在一個特定的顯示寬度下,影像應該停止 "回應",并且應該保持影像的最后尺寸。我怎樣才能做到這一點?
uj5u.com熱心網友回復:
你可以使用max-width css屬性。檔案
.icon-position{
margin-top: 200px;
margin-left: 33.195%;
寬度:61%。
height: auto;
max-width: 1400px; // anyvalue here
}
uj5u.com熱心網友回復:
.image-position{
max-width: 在這里輸入你選擇的寬度。
}
css中的最大寬度是用來定義一個元素可以擁有的最大寬度。在達到最大寬度后,該元素將停止變寬。
謝謝
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/321899.html
標籤:
