Set div to have its siblings width

后端 未结 8 1533
猫巷女王i
猫巷女王i 2020-12-05 09:34

I\'m looking for a CSS solution to the following:-

8条回答
  •  死守一世寂寞
    2020-12-05 10:25

    UPDATE: This works with me, I've just tried it:

    If you use 100% here, it will fit to the width of the mother div automatically.
    The div will be 100% of the mother div too.

    Is this what you want? The borders and background are just to show the divs ;)


    Just go like this:

    Let's say you want the whole divs be max. 980px (otherwise just leave that out or replace with 100%)...

    If you use 100% here, it will fit to the width of the mother div automatically.
    The div will be 100% of the mother div too.

    The second option would be, to use one more div... or you use style="width:auto;" for the dynamic div...

提交回复
热议问题