D
D
Dymok2018-05-06 17:16:37
css
Dymok, 2018-05-06 17:16:37

How to pin a box to the bottom of an owl-carousel slide when using flexbox?

codepen
I'm trying to make the button always be at the bottom, next to the navigation. How to do it simply with flexbox is clear, but for some reason owl-carousel limits the block height to the content, and not to the largest of the slides:

screen
5aef0e2c6743b290764305.jpeg

Please help me find a way to solve the problem. Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
ArtGenSky, 2018-05-06
@UnluckySerivelha

To do this, all slides must be the same height, this can be achieved if the parent container of the slides is flex (by default, the align-content: stretch style rule is applied to flex, which stretches the child elements in height if flex is horizontal).
Inside the slides, add height: 100% to the inner wrapper .header__slider-item so that it takes up the entire height of the parent slide. This wrapper has vertical flex, so the button can be set to margin-top: auto

.owl-carousel .owl-stage {
    position: relative;
    -ms-touch-action: pan-Y;
    -moz-backface-visibility: hidden;
    display: flex;
}
.header__slider-item {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.header__slider-text {
    font-family: Lato;
    font-size: 1.4rem;
    margin-bottom: 20px;
}
.header__slider-btn {
    padding: 21px 33px;
    color: #444444;
    font-family: Montserrat;
    font-size: 1.6rem;
    text-transform: uppercase;
    font-weight: 400;
    border: 1px solid #444444;
    margin: auto auto 0 0;
    transition: 0.2s;
}

S
Slv_Ivn, 2018-05-06
@Slv_Ivn

You can, for example, like this: add a couple of parameters to .header__slider-item

min-height: 320px;
justify-content: space-between;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question