search

Home  >  Q&A  >  body text

javascript - css problem, how to align the container in the div bottom

As shown in the picture, 3 p, how to set 2, 3 is aligned to the bottom in 1; when 3 is hidden, 2 will fall to align to the bottom

大家讲道理大家讲道理2796 days ago795

reply all(6)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-19 10:29:21

    2 and 3 then wrap a 4. How can this 4 be absolutely positioned at bottom 0? Inside this 4, 2 and 3 are in a document stream that is wrapped by itself. If 3 is not there, then 2 can support this 4. Is this consistent?

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-19 10:29:21

    Write logical judgment in js. When 3 is hidden, the positioning top of 2 becomes the positioning top of 3. Ordinary document flow cannot realize automatic drop because the document flow is from left to right and top to bottom. The premise of this situation is that when the height of box 1 is fixed

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-19 10:29:21

    If your 1 is a parent box, then the two 3's inside are subset boxes. You only need to give the height of 2 and 3 or the content inside to support them, and then they can be hidden as 3. When the time comes, you can naturally move it down

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-19 10:29:21

    Use flex

    reply
    0
  • PHPz

    PHPz2017-05-19 10:29:21

    Try flex layout?
    http://www.ruanyifeng.com/blo...

    reply
    0
  • PHP中文网

    PHP中文网2017-05-19 10:29:21

    flex layout

    {
    flex-direction:  column-reverse;
    justify-content: flex-start;
    align-items: center;
    }

    reply
    0
  • Cancelreply