css实现代码编辑器拖动分割容器效果代码
代码语言:html
所属分类:拖放
代码描述:css实现代码编辑器拖动分割容器效果代码,使用prism来格式化显示代码,css实现拖拽。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
* {
box-sizing: border-box;
}
:root {
--aspect-ratio: 16 / 10;
--min-width: 0.5rem;
--frame: hsl(0 0% 25%);
}
body {
display: grid;
place-items: center;
min-height: 100vh;
background: black;
}
.panels {
container-type: inline-size;
width: 90vmin;
aspect-ratio: var(--aspect-ratio);
display: grid;
grid-template-columns: auto 1fr;
overflow: hidden;
border: 4px solid var(--frame);
box-shadow: 0 -1px hsl(0 0% 100% / 0.75);
}
.panel:first-of-type {
position: relative;
}
/* .resizer {
position: relative;
top: 0;
right: 0;
height: 100%;
width: 100%;
resize: horizontal;
overflow: hidden;
max-width: calc(100cqi - 100px);
min-width: 100px;
transform-origin: 100% 100%;
scale: 40;
translate: 24px 0;
background: green;
clip-path: inset(0 0 0 calc(100% - 1px));
} */
.resizer {
position: relative;
top: 50%;
right: 0;
height: 48px;
width: 400px;
resize: horizontal;
overflow: hidden;
max-width: calc(100cqi - var(--min-width));
min-width: calc(var(--min-width) * 3);
transform-origin: 100% 100%;
scale: 4;
translate: 14px -50%;
background: green;
z-index: 9999;
-webkit-clip-path: inset(calc(100% - 12px) 0 0 calc(100% - 12px));
clip-path: inset(calc(100% - 12px) 0 0 calc(100% - 12px));
/* Important to hide it */
opacity: 0;
}
/* Purely used to debug the handle hit spot */
/* .resizer::after {
content: "";
height: 12px;
width: 12px;
border-radius: 50%;
background: red;
position: absolute;
bottom: 0;
right: 0;
} */
.panel:fi.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0