how to prevent child element from overflowing parent element (css position)
the attach image is original work.
I am building a dropdown, but droplist with absolute position overflowing it parent with relative position.
here is the code that demonstrat the work: http://jsfiddle.net/er6tL5q0/1/
Edit fiddle - JSFiddle - Code Playground
Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
2 Replies
You can't. Absolute positioning take the element out of the document flow and it just sits where ever you put it.
But if you're making a dropdown list you should be using the right element for it:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/summary
div
is not the right element, the details
element is literally the drop down elementgot it man