Overflow-x: hidden also hides y content

ぃ、小莉子 提交于 2021-01-28 11:33:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!