9

i am learning css flexbox and i have one problem with javascript sliders. I have tested several (lightgallery.js, swiper.js, siema.js) but everytime it seems to break my flexbox container.

I have a main element and an aside element. On mobile, i wish that the main and the aside elements could be one below the other. It seems to work well. But on a desktop, i wish that the main element fits 2/3 of the max 1000px and the aside element fits 1/3, side by side.

Unfortunatelly, the slider seems to break my .wrap container. I have tested a lot of things and searched for problems like mine but without result. I don't really understand what could solve my problem. I must admit i'm a bit lost.

You can see this problem on this pen (lightgallery.js) : https://codepen.io/studiok7/pen/pxGWMJ

<span>Thanks ;-)</span>
Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
studiok7
  • 97
  • 1
  • 8

1 Answers1

25

By default the flex items (children of flex layout) have the min-width set to auto, so that the parent would show all elements without clipping/overflow. Try adding:

.main {
...
    min-width: 0;
}

to the .main element, as shown in the forked example below: https://codepen.io/anon/pen/vVPLOo

Piotr Wicijowski
  • 1,975
  • 9
  • 15