Prevent a specific child div from expanding the parent div

前端 未结 2 421
傲寒
傲寒 2020-12-29 17:59

I\'m currently developping a website and encountered a problem with CSS.

I have a parent div containing 2 or more children: one containing the name of a

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-29 18:36

    You can use Absolute positioning

    FIDDLE

    position:absolute;
    top:0;
    left:0;
    width:100%;
    

    and on the container div :

    padding-top: /*the height of the absolutly positioned child*/ ;
    position:relative;
    

提交回复
热议问题