我有一个图像滑块运行在我的页面背景。我的问题是图像在较小的屏幕上放大到很多。也许有一种方法,我可以改变宽度或高度的图像,所以它看起来更好,图像不是完全放大。由于我不是很专业的反应设计,特别是在响应图像,也许有人可以给我好的建议。
我的项目就是这样的。屏幕是从高清显示器,但在我的笔记本电脑,它的方式放大和一些图像是难以理解的。

用于图像的CSS:
.sequence .slide-image > img {
max-width: inherit;
display: block;
/*height:auto;*/
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
min-width: 50%;
min-height: 50%;
}HTML部件:
<div class="slide-image scale">
<img src="$KBImage" alt="Welcome to the Loyale"/>
</div>发布于 2018-02-13 18:42:50
可以帮助使用vw和vh单元大小: 100 vw =当前的总窗口宽度大小。100 vh =当前窗口的宽度。
.sequence .slide-image > img {
max-width: 100vw;
max-height: 100vh;
display: block;
/*height:auto;*/
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
min-width: 50vw;
min-height: 50vh;
}发布于 2018-02-13 19:23:12
试试这段代码,它可能对你有帮助。
.sequence .slide-image > img {
max-width: auto!important;
display: block;
/*height:auto;*/
position: fixed;
background-repeat: !important;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
}https://stackoverflow.com/questions/48773274
复制相似问题