问题
I have a container with some text and an image, and a navigation div that should (when the time comes) slide in from the right.
To make this happen, I though I'd push the div to the right of the screen and put overflow-x: hidden
on it's container to hide it, and then push it back into the screen when it's needed.
The problem is, when I set overflow-x: hidden
on the container, it also clips off the vertical content of the navigation.
Here's a fiddle with a demo.
What I have tried:
- Setting different values for
overflow-y
- placing the navigation div in different containers, inside and outside of the content container
None of which seem to work.
I have looked at other questions with a similiar issues, but none solve my problem - they suggest alternative solutions that don't fit my situation.
Thanks!
回答1:
This is from your .img
class in CSS, where you have height: 200px;
. The image you're loading is actually 310px tall, and thus you get that the bottom third (approximately) is clipped off.
来源:https://stackoverflow.com/questions/35045560/overflow-x-hidden-also-hides-y-content