我在页面顶部的幻灯片具有width:100%
和height:400px
css 属性。
但我想制作一个响应式网页,并根据页面的宽度使幻灯片高度可变。
我尝试过使用min-height
,但它不起作用。
我尝试将容器height
打开400px
并将图像高度设置为自动,这部分解决了问题,因为幻灯片的高度会响应地变化,但容器保持不变,400px
从而在滑块和菜单栏之间留出空白空间。
你有什么想法?
我的CSS如下:
.container {
padding:0px;
margin:0px;
position:relative;
padding:0;
height:400px;
}
.img {
position:absolute;
left:0;
top:0;
width:100%;
height:400px;
min-height:auto;
}