在我的網路瀏覽器中,如果被擠壓,我的 Android 手機 100% 可以完美運行。不是這樣的 iphone 檢查。
對于影像,我通常使用 max-width: 100%; 當情況適合寬度時:100%;或影像回應。圖片寬度大于 600px;因此我將寬度設定為 600px 以在較大的設備上控制它。
<section class='section20'>
<figure class="image">
<img src="images/user-content/1/20221003160546.jpg">
</figure>
</section>
CSS:
.section20 .image,
.section20 img {
width: 600px !important;
max-width: 100% !important;
}
添加 !important 與否沒有區別。格式化編輯器是 CKEditor 5。在代碼中如何處理類是相當棘手的。如果您在代碼視圖中添加您的自定義類,它會在回傳到格式化編輯器視圖時將其剝離。
<figure class="image">
<figure class="image my-custom-class">
custom-class 將被剝離。
uj5u.com熱心網友回復:
檢查您的選擇器。
Using.section20 .image指示img包裝器保持不變600px并且不會使用max-width: 100%;.
改為使用.image img。
.image img {
width: 600px;
max-width: 100%;
}
<section class='section20'>
<figure class="image">
<img src="https://dummyimage.com/600x400/000/fff">
</figure>
</section>
uj5u.com熱心網友回復:
不要硬編碼寬度和高度。選擇 rem 或 vw/vh(推薦)。
.section20 .image,
.section20 img {
width: 35rem ; // or type the equivalent rem value
max-width: 100vh ;
}
表示此元素的高度等于視口高度的 100%。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/516009.html
標籤:htmlcss苹果手机
