CSS实现拖拽转变布局大小
发布时间:09/01 来源:未知 浏览:
关键词:
.resize-bar::-webkit-scrollbar { width: 200px; height: 200px; }
此时,拉伸区域就很大了:
.column { overflow: hidden; } .column-left { height: 400px; background-color: #fff; position: relative; float: left; } .column-right { height: 400px; padding: 16px; background-color: #eee; box-sizing: border-box; overflow: hidden; } .resize-save { position: absolute; top: 0; right: 5px; bottom: 0; left: 0; padding: 16px; overflow-x: hidden; } .resize-bar { width: 200px; height: inherit; resize: horizontal; cursor: ew-resize; opacity: 0; overflow: scroll; } /* 拖拽线 */ .resize-line { position: absolute; right: 0; top: 0; bottom: 0; border-right: 2px solid #eee; border-left: 1px solid #bbb; pointer-events: none; } .resize-bar:hover ~ .resize-line, .resize-bar:active ~ .resize-line { border-left: 1px dashed skyblue; } .resize-bar::-webkit-scrollbar { width: 200px; height: inherit; } /* Firefox只要下面一小块区域可以拉伸 */ @supports (-moz-user-select: none) { .resize-bar:hover ~ .resize-line, .resize-bar:active ~ .resize-line { border-left: 1px solid #bbb; } .resize-bar:hover ~ .resize-line::after, .resize-bar:active ~ .resize-line::after { content: ''; position: absolute; width: 16px; height: 16px; bottom: 0; right: -8px; background: url(./resize.svg); background-size: 100% 100%; } }
左侧的内容,左侧的内容,左侧的内容,左侧的内容
右边的内容,右边的内容,右边的内容,右边的内容
应用阅读器非overflow:auto
元素设定resize
可以拉伸的特性实现无JavaScript的分栏宽度控制。
webkit阅读器下滚动条可以自定义,其中resize区域大小就是scrollbar的大小,于是,我们可以将整个拉伸区域酿成和容器同样高。
举荐教程:《CSS教程》
以上就是CSS 实现拖拽转变布局大小的细致内容,更多请关注 百分百源码网 其它相干文章!