css 拖拽改变宽度

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .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;
            cursor: col-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%;
            }
        }
    </style>
</head>
 
<body>
    <div class="column">
        <div class="column-left">
            <div class="resize-bar"></div>
            <div class="resize-line"></div>
            <div class="resize-save">
                左侧的内容,左侧的内容,左侧的内容,左侧的内容
            </div>
        </div>
        <div class="column-right">
            右侧的内容,右侧的内容,右侧的内容,右侧的内容
        </div>
    </div>
</body>
 
</html>

  

posted @   7c89  阅读(238)  评论(0编辑  收藏  举报
(评论功能已被禁用)
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
· SQL Server 2025 AI相关能力初探
点击右上角即可分享
微信分享提示