起因: 翻 ruby 在线文档页面时,希望左边那些导航标签能相对固定住, 滚动 /跳转页面时只是右边内容部分动。 比如这个页面: http://ruby-doc.org/core-2.3.1/Array.html 想划成左右两块,左边点击时右边跳动,而左右两边能独立的下拉滚动等。
请问这个能做到吗? 烦请老司机带路,谢谢!
1
hcwhan 2016-06-23 16:53:26 +08:00 via Android
css 固定定位
|
2
hcwhan 2016-06-23 16:55:15 +08:00 via Android 1
sorry 请无视我 只看了标题,,
|
3
kokdemo 2016-06-23 17:08:39 +08:00
让左右两边 div 的 display 设置成 inline-block , height 100vh (或者 100%), overflow-y 写成 scroll
|
4
quix 2016-06-23 18:00:46 +08:00 1
左边改成 postion: fixed 内部加 overflow: auto, 右边不需要动
|
5
muzuiget 2016-06-23 18:59:06 +08:00 1
不谢
(function(cssText) { var head = document.querySelector('head'); var style = document.createElement('style'); style.setAttribute('type', 'text/css'); style.textContent = cssText; head.appendChild(style); })(` .class #metadata, .file #metadata, .module #metadata { float: left; height: 100vh; overflow: auto; position: sticky; top: 0; width: 260px;`) |