Forums

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

Home Forums CSS Collapse parent width containing floating elements

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #198339
    sjoerdth
    Participant

    Example:
    http://codepen.io/sjoerdth/pen/EaOQBv

    When you resize the example horizontally the right box will fall under the left box, which is fine. But I would like the parent div (wrapper) to become a wide as the widest child at the moment.

    I would like to solve it using css only and without a magic number media-query thingy, but I can’t work it out :(

    #198342
    Paulie_D
    Member

    without a magic number media-query thingy

    How else to you expect things to change?

    You have to tell CSS to do something at some point….it isn’t psychic…or magic.

    #198343
    sjoerdth
    Participant

    I don’t know, that’s why I’m asking. Sometimes there’s a solution to a problem you just didn’t think of, sometimes there isn’t.

    #198345
    Paulie_D
    Member

    CSS can’t detect content shifts or changes…it can only style things based on what you tell it to do.

    If you’re setting fixed widths on things and need them to do something different when the combined widths are to much you either need media queries or javascript.

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