【问题标题】:Bootstrap carousel expand image from bottomBootstrap轮播从底部展开图像
【发布时间】:2014-05-23 06:38:31
【问题描述】:

我在一个网站中使用 Bootstrap 轮播,它是屏幕的全宽和响应高度。问题是,由于图像的性质,我希望图像与 .item div 的底部对齐,并从底部展开,而不是像往常一样从左上角展开。这可以用 CSS 完成还是只能用 JS 完成?

你可以看到网站和代码here

【问题讨论】:

    标签: html image css twitter-bootstrap-3 carousel


    【解决方案1】:

    您可以将bottom: 145% 设置为img-tag 并将其移动到包装.item-class 的顶部。 .item, .carousel-inner, .carousel-classes 需要修复 height-property 才能使其工作。

    像这样:

    .carousel, .carousel-inner, .item {
       height:100%;
       max-height:600px;
    }
    .carousel-inner > .item > img, 
    .carousel-inner > .item > a > img {
       position: relative;
       bottom: 145%;
    }
    

    只需在物业周围玩耍以找到最佳位置。

    【讨论】:

    • 添加对我来说不会以任何方式改变图像
    • 好吧,抱歉,我错过了一些部分。您必须将height: 600px 添加到.item.carousel-inner 类。因为元素需要一个固定的高度。我会更新我的答案。
    • 我不希望图像具有固定高度,因为我希望它可以针对不同的窗口和屏幕尺寸进行调整。
    • 对我来说仍然无法正常工作,因为当您将窗口缩小时,需要查看所有图像,底部有一个间隙
    猜你喜欢
    • 2015-10-06
    • 2015-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多