Child with position:fixed scrolls with position:fixed, overflow:auto parent

lavirius

I have a parent with position:fixed; width/height:100%; overflow:auto and a child that also has position:fixed. When the parent's content overflows and the parent starts scrolling I would expect the child to stay fixed in relation to the viewport. It does not.

the scenario is a slide down panel on top of the content using css transforms. The slide-down panel has a close button that should stay in view while the panel's content scrolls. Change the .overlay-slidedown class on the .overlay element to .overlay-fade and, in that case, the close button will stay in it's place.

https://jsfiddle.net/xajk7uez/3/

Roy

If you add an extra layer within.overlay as a sibling to .overlay-close to only address the overflow-y: scroll; the position: fixed; on .overlay-close will work. This .overlay-content layer should also be 100% width/height

.overlay > .overlay-content {
    width: 100%;
  height: 100%;
  overflow: auto;
}

See updated Fidle for the demo.

https://jsfiddle.net/n0wxfc60/2/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Child with position:fixed scrolls with position:fixed, overflow:auto parent

From Dev

How to add scroll auto on overflow in case the parent as `fixed` position

From Dev

Position fixed 100 of parent

From Dev

How to position a child element at the bottom of a fixed position parent

From Dev

css "position:fixed; overflow:auto;" bad bottom padding

From Dev

scroll property in a child element of a parent div whose position is fixed

From Dev

Make child div larger than fixed position parent div

From Dev

CSS Force nested child behind parent with position:fixed

From Dev

CSS Force nested child behind parent with position:fixed

From Dev

Fixed position relative to parent container

From Dev

CSS Overflow problems with fixed position divs

From Dev

scroll and position: fixed inside overflow: scroll div

From Dev

Position fixed and overflow-y:scroll issue

From Dev

Position fixed sidebar with overflow scroll not scrolling to bottom

From Dev

Overflow scrolling not working on position fixed element iOS

From Dev

Fixed position div to overflow containing div

From Dev

HTML CSS Div Overflow & Position "fixed"

From Dev

CSS position fixed AND margin 0 auto

From Dev

Child of position: fixed; won't scroll

From Dev

Margin inheritance from child with fixed position

From Dev

Element position fixed is related to parent instead to the viewport

From Dev

DIV CSS Layout - fixed position expand parent

From Dev

Make position: fixed element respect parent with position: relative

From Dev

Make position: fixed element respect parent with position: relative

From Dev

Flexbox: make child fill 100% height of it's parent in this layout without fixed height or position absolute

From Dev

Bug chrome : parent fixed scroll, 1st fixed child (background-color) scrolls too

From Dev

position relative overlapping position fixed

From Dev

How to position container to fixed position?

From Dev

position absolute inside position fixed

Related Related

  1. 1

    Child with position:fixed scrolls with position:fixed, overflow:auto parent

  2. 2

    How to add scroll auto on overflow in case the parent as `fixed` position

  3. 3

    Position fixed 100 of parent

  4. 4

    How to position a child element at the bottom of a fixed position parent

  5. 5

    css "position:fixed; overflow:auto;" bad bottom padding

  6. 6

    scroll property in a child element of a parent div whose position is fixed

  7. 7

    Make child div larger than fixed position parent div

  8. 8

    CSS Force nested child behind parent with position:fixed

  9. 9

    CSS Force nested child behind parent with position:fixed

  10. 10

    Fixed position relative to parent container

  11. 11

    CSS Overflow problems with fixed position divs

  12. 12

    scroll and position: fixed inside overflow: scroll div

  13. 13

    Position fixed and overflow-y:scroll issue

  14. 14

    Position fixed sidebar with overflow scroll not scrolling to bottom

  15. 15

    Overflow scrolling not working on position fixed element iOS

  16. 16

    Fixed position div to overflow containing div

  17. 17

    HTML CSS Div Overflow & Position "fixed"

  18. 18

    CSS position fixed AND margin 0 auto

  19. 19

    Child of position: fixed; won't scroll

  20. 20

    Margin inheritance from child with fixed position

  21. 21

    Element position fixed is related to parent instead to the viewport

  22. 22

    DIV CSS Layout - fixed position expand parent

  23. 23

    Make position: fixed element respect parent with position: relative

  24. 24

    Make position: fixed element respect parent with position: relative

  25. 25

    Flexbox: make child fill 100% height of it's parent in this layout without fixed height or position absolute

  26. 26

    Bug chrome : parent fixed scroll, 1st fixed child (background-color) scrolls too

  27. 27

    position relative overlapping position fixed

  28. 28

    How to position container to fixed position?

  29. 29

    position absolute inside position fixed

HotTag

Archive