How can I get an absolutely-positioned div to extend outside its relativley-positioned parent, which has overflow: auto?

前端 未结 8 769
栀梦
栀梦 2021-02-01 14:53

I have a relatively -positioned div, which has overflow: auto set. Inside that, I have a div which acts as a sort of drop-down menu. I want the drop-down div to e

8条回答
  •  忘了有多久
    2021-02-01 14:54

    Given your specifications, this is the best I could came up with:

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

    There you have your div with overflow: auto; so scroll bars will appear if needed, and the drop-down div will look like it's extending "outside it's parent". Both are kept together under the same parent div, as you stated that they were contextually relevant to each other.

提交回复
热议问题