I have a situation where I need to position an element absolutely, like a drop-down menu. However, when the window is resized and becomes narrow, there is not enough space for it.
My requirements are:
- The right edge of the dropdown should not go beyond its container. It should have a style like max-right: 0;
- Cross-browser compatibility is necessary
- Ideally, avoid using JavaScript. If impossible, keep the JavaScript simple and efficient.