Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Shrinking flexbox container to contents

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #251681
    inktrap
    Participant

    I’ve been struggling trying to do this. Is there a way to make the flexbox container shrinkwrap its contents – for example, like display: table; does?

    #251682
    Beverleyh
    Participant

    I have no idea what you mean but if you mock something up for us in a CodePen demo – include a basic flexbox and display:table; sample side-by-side to show us what you mean – we can offer suggestions.

    #251683
    Paulie_D
    Member

    Sure there is…display:inline-flex

    http://codepen.io/Paulie-D/pen/VPJLXN

    #251699
    mmcgu1966
    Participant

    OOHH.. NICE. Didn’t know that one either. Thanks Paulie_D

    #251706
    inktrap
    Participant

    Thanks. That did the trick because I happen to have only one inline-flex container in the parent block, but the problem in general is that it will stack containers side-to-side instead of vertically. I don’t suppose there’s a way to avoid that?

    #251709
    Paulie_D
    Member

    Not really, inline-flex works the same way as any other inline element, span, inline-block, inline-table etc.

    If you want more than one “container” you may have to think about how you are structuring your HTML.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘CSS’ is closed to new topics and replies.