Extend child div beyond container div

后端 未结 4 913
攒了一身酷
攒了一身酷 2020-12-17 08:39

I\'m trying to expand this div across with width of the browser. I\'ve read from here that you can use {position:absolute; left: 0; right:0;} to achieve that a

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-17 09:16

    I can think of five ways to potentially accomplish your goal:

    1. Use negative margins on the inner element to move it outside of the parent

    2. Use Javascript to move the inner element outside of the parent.

    3. Change the source code and move the inner element outside of the parent.

    4. Use position: fixed on the inner element. This will allow the inner element to break out but has the down side that the element will be fixed at the given position (never moving).

    5. Remove the position: relative; from the parent element or give the parent element a position: static

提交回复
热议问题