Cross browser method to fit a child div to its parent's width

前端 未结 6 979
礼貌的吻别
礼貌的吻别 2020-12-04 15:01

I\'m looking for a solution to fit a child div into it\'s parent\'s width.

Most solutions I\'ve seen here are not cross-browser com

6条回答
  •  無奈伤痛
    2020-12-04 15:37

    If you put position:relative; on the outer element, the inner element will place itself according to this one. Then a width:auto; on the inner element will be the same as the width of the outer.

提交回复
热议问题