Html 将带有两个div标签的页面拆分为两部分,每个部分都带有&x27;用户自己的滚动条

Html 将带有两个div标签的页面拆分为两部分,每个部分都带有&x27;用户自己的滚动条,html,css,scroll,overflow,Html,Css,Scroll,Overflow,我目前有一个HTML页面,有两个标记,将页面分成两列。整个页面可以上下滚动,但我希望每一列都有自己的滚动条,这样一列可以一直滚动到底,另一列可以一直滚动到顶部等等。有人知道我是如何做到这一点的吗?试试这个: <!DOCTYPE html> <html> <head> <title>test</title> <style> .container { display: fl

我目前有一个HTML页面,有两个
标记,将页面分成两列。整个页面可以上下滚动,但我希望每一列都有自己的滚动条,这样一列可以一直滚动到底,另一列可以一直滚动到顶部等等。有人知道我是如何做到这一点的吗?

试试这个:

<!DOCTYPE html>
<html>
<head>
    <title>test</title>
    <style>
        .container {
            display: flex;
            flex-direction: row;
        }
        .left {
            height: 400px;
            display: block;
            width: 50%;
            background-color: green;
            overflow-y: scroll;
        }
        .right {
            height: 400px;
            background-color: red;
            display: block;
            width: 50%;
            overflow-y: scroll;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="left"></div>
        <div class="right"></div>
    </div>
</body>
</html>

测试
.集装箱{
显示器:flex;
弯曲方向:行;
}
.左{
高度:400px;
显示:块;
宽度:50%;
背景颜色:绿色;
溢出y:滚动;
}
.对{
高度:400px;
背景色:红色;
显示:块;
宽度:50%;
溢出y:滚动;
}

您只需添加overflow-y:scroll到您的div。

您可以尝试以下方法:

.main{
宽度:100%;
}
#第一列{
高度:100px;
宽度:45%;
边框:1px纯红;
浮动:左;
溢出y:滚动;
}
#第二列{
高度:100px;
宽度:45%;
左边距:50%;
边框:1px纯蓝色;
溢出y:滚动;
}

当API返回图像时。我看到越来越多的图像响应获取API。使用这个术语,我的意思是:使用GET URL调用API,响应是(JPG/PNG/GIF/WEBP/SVG)图像,可以是直接的,也可以是重定向后的。因此,可以通过简单的
当API返回图像时。我看到越来越多的图像响应获取API。使用这个术语,我的意思是:使用GET URL调用API,响应是(JPG/PNG/GIF/WEBP/SVG)图像,可以是直接的,也可以是重定向后的。因此,可以通过简单的
请尝试以下操作:

演示链接:

index.html

<!DOCTYPE html>
<html lang="en">

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
        integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous" />

    <title>File compare</title>
    <style>
        .flex {
            display: flex;
            flex-direction: row;
        }

        .flex>.split {
            height: 100vh;
            overflow-y: scroll;
        }

        .gutter.gutter-horizontal {
            cursor: ew-resize;
        }

        .gutter {
            background-color: #eee;
            background-repeat: no-repeat;
            background-position: 50%;
        }

        .gutter.gutter-horizontal {
            background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==');
        }

        .heading {
            padding: 15px;
            background: #eeeeee;
            text-align: center;
            font-weight: 800;
            color: #0062cc;
            letter-spacing: 2px;
        }
    </style>
</head>

<body>
    <div class="flex">
        <div id="one" class="split">
            <div class="heading">
                Column one
            </div>
            <h4>What is Lorem Ipsum?</h4>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
                been the industry's standard dummy text ever since the 1500s, when an unknown printer took a
                galley of type and scrambled it to make a type specimen book. It has survived not only five
                centuries, but also the leap into electronic typesetting, remaining essentially unchanged. I
                t was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum pas
                sages, and more recently with desktop publishing software like Aldus PageMaker including version
                s of Lorem Ipsum.</p>

            <h4>What is Lorem Ipsum?</h4>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
                been the industry's standard dummy text ever since the 1500s, when an unknown printer took a
                galley of type and scrambled it to make a type specimen book. It has survived not only five
                centuries, but also the leap into electronic typesetting, remaining essentially unchanged. I
                t was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum pas
                sages, and more recently with desktop publishing software like Aldus PageMaker including version
                s of Lorem Ipsum.</p>
            <h4>What is Lorem Ipsum?</h4>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
                been the industry's standard dummy text ever since the 1500s, when an unknown printer took a
                galley of type and scrambled it to make a type specimen book. It has survived not only five
                centuries, but also the leap into electronic typesetting, remaining essentially unchanged. I
                t was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum pas
                sages, and more recently with desktop publishing software like Aldus PageMaker including version
                s of Lorem Ipsum.</p>
            <h4>What is Lorem Ipsum?</h4>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
                been the industry's standard dummy text ever since the 1500s, when an unknown printer took a
                galley of type and scrambled it to make a type specimen book. It has survived not only five
                centuries, but also the leap into electronic typesetting, remaining essentially unchanged. I
                t was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum pas
                sages, and more recently with desktop publishing software like Aldus PageMaker including version
                s of Lorem Ipsum.</p>
        </div>
        <div id="two" class="split">
            <div class="heading">
                Column two
            </div>
            <h4>What is Lorem Ipsum?</h4>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
                been the industry's standard dummy text ever since the 1500s, when an unknown printer took a
                galley of type and scrambled it to make a type specimen book. It has survived not only five
                centuries, but also the leap into electronic typesetting, remaining essentially unchanged. I
                t was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum pas
                sages, and more recently with desktop publishing software like Aldus PageMaker including version
                s of Lorem Ipsum.</p>
            <h4>What is Lorem Ipsum?</h4>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
                been the industry's standard dummy text ever since the 1500s, when an unknown printer took a
                galley of type and scrambled it to make a type specimen book. It has survived not only five
                centuries, but also the leap into electronic typesetting, remaining essentially unchanged. I
                t was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum pas
                sages, and more recently with desktop publishing software like Aldus PageMaker including version
                s of Lorem Ipsum.</p>
            <h4>What is Lorem Ipsum?</h4>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
                been the industry's standard dummy text ever since the 1500s, when an unknown printer took a
                galley of type and scrambled it to make a type specimen book. It has survived not only five
                centuries, but also the leap into electronic typesetting, remaining essentially unchanged. I
                t was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum pas
                sages, and more recently with desktop publishing software like Aldus PageMaker including version
                s of Lorem Ipsum.</p>
            <h4>What is Lorem Ipsum?</h4>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
                been the industry's standard dummy text ever since the 1500s, when an unknown printer took a
                galley of type and scrambled it to make a type specimen book. It has survived not only five
                centuries, but also the leap into electronic typesetting, remaining essentially unchanged. I
                t was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum pas
                sages, and more recently with desktop publishing software like Aldus PageMaker including version
                s of Lorem Ipsum.</p>

        </div>
    </div>


    </div>
    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
        integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous">
    </script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
        integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous">
    </script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/split.js/1.5.11/split.min.js"></script>
    <script>
        Split(['#one', '#two'], {
            sizes: [50, 50]
        });
    </script>
</body>

</html>

文件比较
.flex{
显示器:flex;
弯曲方向:行;
}
.flex>.split{
高度:100vh;
溢出y:滚动;
}
.排水沟.排水沟-水平{
光标:ew调整大小;
}
.排水沟{
背景色:#eee;
背景重复:无重复;
背景职位:50%;
}
.排水沟.排水沟-水平{
背景图像:url('data:image/png;base64,ivborw0kggoaaaansuhueugaaaaaaaaaaecayadkfts9aaaikleqvqou2m4c+bmfxagagymymwgriijreljpo5aizemwf+yNnOs5KSvgAAAABJRU5ErkJggg=');
}
.标题{
填充:15px;
背景:#eeeeee;
文本对齐:居中;
字号:800;
颜色:#0062cc;
字母间距:2px;
}
第一栏
什么是Lorem Ipsum?
Lorem Ipsum只是印刷和排版行业的虚拟文本。同侧眼睑
从16世纪开始,这就是行业标准的虚拟文本,当时一台不知名的打印机拍了一张照片
把它翻成一本样书。它不仅存活了五年
几个世纪以来,电子排版也出现了飞跃,基本保持不变。我
20世纪60年代,随着包含Lorem Ipsum pas的Letraset表的发布,t开始流行
sages和最近的桌面发布软件,如Aldus PageMaker,包括版本
同侧心路的s

什么是Lorem Ipsum? Lorem Ipsum只是印刷和排版行业的虚拟文本。同侧眼睑 从16世纪开始,这就是行业标准的虚拟文本,当时一台不知名的打印机拍了一张照片 把它翻成一本样书。它不仅存活了五年 几个世纪以来,电子排版也出现了飞跃,基本保持不变。我 20世纪60年代,随着包含Lorem Ipsum pas的Letraset表的发布,t开始流行 sages和最近的桌面发布软件,如Aldus PageMaker,包括版本 同侧心路的s

什么是Lorem Ipsum? Lorem Ipsum只是印刷和排版行业的虚拟文本。同侧眼睑 从16世纪开始,这就是行业标准的虚拟文本,当时一台不知名的打印机拍了一张照片 把它翻成一本样书。它不仅存活了五年 几个世纪以来,电子排版也出现了飞跃,基本保持不变。我 20世纪60年代,随着包含Lorem Ipsum pas的Letraset表的发布,t开始流行 sages和最近的桌面发布软件,如Aldus PageMaker,包括版本 同侧心路的s

什么是Lorem Ipsum? Lorem Ipsum只是印刷和排版行业的虚拟文本。同侧眼睑 从16世纪开始,这就是行业标准的虚拟文本,当时一台不知名的打印机拍了一张照片 把它翻成一本样书。它不仅存活了五年 几个世纪以来,电子排版也出现了飞跃,基本保持不变。我 20世纪60年代,随着包含Lorem Ipsum pas的Letraset表的发布,t开始流行 sages和最近的桌面发布软件,如Aldus PageMaker,包括版本 同侧心路的s

第二栏 什么是Lorem Ipsum?