Fixed position div on top vertical space

≯℡__Kan透↙ 提交于 2021-01-27 12:25:07

问题


My situation is that I have fixed position div with percented height at the bottom of page that is on top of it(see picture). The issue is that when I scroll page to the end, some of its content is hidden beneath this div. I think I should add empty element at the bottom of page, but what is the best way to do it? enter image description here


回答1:


A nice solution could be to change the height of the fixed div to be expressed in vh not in % (see), for example:

div.fixed-at-bottom { height: 20vh; .... }

and then set a margin-bottom to your contents div with the same value (or a little more to get more space):

div.content { margin-bottom: 22vh; .... }

I created a jsfiddle to present that.



来源:https://stackoverflow.com/questions/31311323/fixed-position-div-on-top-vertical-space

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