根據瀏覽器大小自動調整解析度的全尺寸影像
P粉302160436
P粉302160436 2023-08-16 11:40:39
0
1
294
<p>我有貨運網站。 </p> <p>如何讓我的懸停圖片填滿整個螢幕,並且不受電腦螢幕解析度的影響。當我縮小瀏覽器視窗時,它們也應該進行裁剪和縮小。謝謝。 </p> <pre class="brush:php;toolbar:false;">.hover-image { display: flex; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: -1; pointer-events: none; flex-direction: column; align-items: center; justify-content: center; /* 將寬度和高度變更為縮放影像 */ width: 100vw; height: auto; } .hover-image img { max-width: 100% !important; max-height: 100% !important; width: auto !important; height: auto !important; margin-bottom: 0; }</pre> Image Hover One {image 1} Image Hover Two {image 2} <p>我嘗試過使用像素,但那是特定於解析度的。 </p>
P粉302160436
P粉302160436

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!