I have a Card div that is supposed to show the scroll if the content exceeds it's height. I've used overflow-y: auto to do that. I'm trying to use a Select inside it, and the select menu is supposed to show in front of the card. The menu position is absolute.
The problem is, even with position: absolute, the menu is taking space inside the card. making it scrollable.
If I remove the overflow from the card, it works fine, but the content exceeds it. I've created a sandbox for it:
https://codesandbox.io/s/position-absolute-inside-overflow-y-9kppcy?file=/src/App.js
Other things I have tried
Show the
SelectMenuinside a portal.- Better results I got so far, but when the window is scrolled, the menu got fixed in the screen.
Remove the overflow from the card, add it to a
CardBodyelement, and keep the select outside it.- Did the magic, but with deep nested divs, is really hard to keep it outside every element with overflow.
- Did not work if the Select is inside a modal (because modals should have a scroll).
More details
- I'm using react-select to create my select, but the problem is strictly css and html.
This might be a common question, but I could not find a solution.

css-tricks) which describe really your problem, follow what they say and I hope you will solve it soon. good coding day!