Forums

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

Home Forums CSS Dynamic Width with CSS only

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #249911
    theindianajones
    Participant

    In CSS is there a way to keep width always wide enough to keep its child elements?

    I would like something like this

    |— container —|

    |- box -||- box -|

    |

    container

    |

    |- box -||- box -||- box -||- box -|

    #249915
    Beverleyh
    Participant

    Without knowing details, you could use the ‘width’ or ‘min-width’ CSS properties with a fixed unit value on the container. This should stop the container from shrinking/shrinking past a certain point, BUT, there’s a chance that this will break the layout higher up the DOM and/or generate horizontal scrollbars, which might not be what you want.

    To offer more specific help, we’d need to see examples of code in something like codepen.io

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