How to extend Twitter Bootstrap image carousel for dynamically sized, centered images

前端 未结 3 1548
春和景丽
春和景丽 2021-02-06 04:05

I\'m trying to extend the default Bootstrap image carousel to support dynamically sized images (500x400 max), centered both horizontally and vertically. Additionally, I\'d like

3条回答
  •  攒了一身酷
    2021-02-06 04:39

    Use the CSS background property directly on the div containing the carousel item:

    In the *.html:

    In the *.css:

    .carousel .item {
        background-position: center center;
        background-repeat: no-repeat;
        background-size: cover;
    }
    

    However, this seems to break the carousel navigation arrows.

提交回复
热议问题