【发布时间】:2015-04-29 07:12:56
【问题描述】:
我在页面顶部的幻灯片具有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;
}
【问题讨论】:
-
你试过自动身高吗?
-
你能与 JSFIDDlE 中的 demo 分享你的代码吗?没有浮动:两者; css 属性。我的建议你可以使用所有滑块图像作为通用尺寸。
标签: css responsive-design slideshow responsive-slides