RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / 问题 / 1539037
Accepted
TopTTeDHbIu-DeJLbFuH4uk
TopTTeDHbIu-DeJLbFuH4uk
Asked:2023-09-04 18:32:55 +0000 UTC2023-09-04 18:32:55 +0000 UTC 2023-09-04 18:32:55 +0000 UTC

在模态窗口中滚动而不消失效果

  • 772

如何向模态窗口添加滚动条,使其仅在文本高度超过窗口高度时出现并仍保留所有效果?在此输入图像描述 在此输入图像描述

UPD:不应该有底部滚动

HTML:

    <div class="container-modal-window-easy-difficult">
    <div class="modal-window-easy-difficult">
        <div class="header-easy-difficult">EASY</div>
        <div class="content-wrapper">
            <div class="text-modal-window-easy-difficult">
                The Easy difficulty level on our website is the perfect starting point for those who are just beginning
                their journey into the world of tasks and challenges. Here, you will find puzzles and tasks that provide an
                inspiring challenge but won't be overly difficult. With this level of difficulty, you can familiarize
                yourself with basic concepts and patterns, which will gradually help you develop your skills and move on to
                more serious challenges. Raise the bar of your knowledge with ease and confidence as you prepare for more
                complex trials ahead.
            </div>
        </div>
        <div class="container-btn">
            <button class="close-btn">CLOSE</button>
            <button class="next-btn">NEXT</button>
        </div>
    </div>
</div>

CSS:

body {
    background-color: #16171b;
    margin: 0;
    padding: 0;
}

.container-modal-window-easy-difficult {
    position: absolute;
    top: 190px;
    left: 600px;
}

@property --gradient-angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

:root {
    --clr-1: #052b2f;
    --clr-2: #073438;
    --clr-3: #0e4b50;
    --clr-4: #2d578f;
    --clr-5: #0038ad;
}

.modal-window-easy-difficult{
    height: 500px;
    width: 700px;
    background: var(--clr-1);
    border-radius: 0.5rem;

    position: relative;
    /*overflow-y: scroll;*/
}

.modal-window-easy-difficult::before,
.modal-window-easy-difficult::after {
    content: "";
    position: absolute;
    inset: -0.5rem;
    z-index: -1;
    background: conic-gradient(
            from var(--gradient-angle),
            var(--clr-3),
            var(--clr-4),
            var(--clr-5),
            var(--clr-4),
            var(--clr-3)
    );
    border-radius: inherit;
    animation: rotation 5s linear infinite;
}

.modal-window-easy-difficult::after {
    filter: blur(3.5rem);
}

@keyframes rotation {
    0% {
        --gradient-angle: 0deg;
    }
    100% {
        --gradient-angle: 360deg;
    }
}

/* SCROLLBAR */
::-webkit-scrollbar {
    background-color: #0e4b50;
    width: 7px;
}

::-webkit-scrollbar-thumb {
    background-color: #0038ad;
}

/* CONTENT */
.header-easy-difficult {
    display: flex;
    flex-direction: row;
    justify-content: center;
    padding-top: 10px;
    width: 100%;
    height: 40px;

    font-size: 30px;
    color: #0038ad;
    font-weight: bold;
    font-family: 'Kanit', sans-serif;
    letter-spacing: .1em;
    filter: brightness(300%);

    user-select: none;
}


.text-modal-window-easy-difficult {
    padding: 10px 15px 15px;

    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    color: #c1c1c1;;
    font-weight: bold;
    text-align: justify;
}

/* BUTTON CLOSE */
.container-btn {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-height: 100px;
    padding-top: 20px;
    font-family: 'Raleway', sans-serif;
}

.close-btn{
    height: 50px;
    width: 100px;
    background-color: #050801;
    color: #03e9f4;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    letter-spacing: 4px;
    overflow: hidden;
    transition: 0.5s;
    cursor: pointer;
}

.close-btn:hover{
    background: #03e9f4;
    color: #050801;
    box-shadow: 0 0 5px #03e9f4,
    0 0 25px red,
    0 0 25px darkred;
    /*0 0 25px #03e9f4;*/
    /*0 0 50px #03e9f4,*/
    /*0 0 200px #03e9f4;*/
    -webkit-box-reflect:below 1px linear-gradient(transparent, #0005);
}

/* BUTTON NEXT */
.next-btn{
    height: 50px;
    width: 100px;
    background-color: #050801;
    color: #03e9f4;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    letter-spacing: 4px;
    overflow: hidden;
    transition: 0.5s;
    cursor: pointer;
}

.next-btn:hover{
    background: #03e9f4;
    color: #050801;
    box-shadow: 0 0 5px #03e9f4,
    0 0 25px #03e9f4,
    0 0 25px #03e9f4;
    /*0 0 50px #03e9f4,*/
    /*0 0 200px #03e9f4;*/
    -webkit-box-reflect:below 1px linear-gradient(transparent, #0005);
}
html
  • 1 1 个回答
  • 20 Views

1 个回答

  • Voted
  1. Best Answer
    MRGRD56
    2023-09-05T00:15:51Z2023-09-05T00:15:51Z

    你可以尝试在里面添加一个额外的包装。.modal-window-easy-difficult
    在我的例子中是.modal-content

    并在那里添加overflow-y: auto:

    .modal-content {
        overflow-y: auto;
        max-height: 100%;
    }
    
    .container-btn {
        margin-bottom: 50px;
    }
    

    完整代码:

    body {
        background-color: #16171b;
        margin: 0;
        padding: 0;
    }
    
    .container-modal-window-easy-difficult {
        position: absolute;
        top: 190px;
        left: 600px;
    }
    
    @property --gradient-angle {
        syntax: "<angle>";
        initial-value: 0deg;
        inherits: false;
    }
    
    :root {
        --clr-1: #052b2f;
        --clr-2: #073438;
        --clr-3: #0e4b50;
        --clr-4: #2d578f;
        --clr-5: #0038ad;
    }
    
    .modal-window-easy-difficult{
        height: 500px;
        width: 700px;
        background: var(--clr-1);
        border-radius: 0.5rem;
    
        position: relative;
        /*overflow-y: scroll;*/
    }
    
    .modal-window-easy-difficult::before,
    .modal-window-easy-difficult::after {
        content: "";
        position: absolute;
        inset: -0.5rem;
        z-index: -1;
        background: conic-gradient(
                from var(--gradient-angle),
                var(--clr-3),
                var(--clr-4),
                var(--clr-5),
                var(--clr-4),
                var(--clr-3)
        );
        border-radius: inherit;
        animation: rotation 5s linear infinite;
    }
    
    .modal-window-easy-difficult::after {
        filter: blur(3.5rem);
    }
    
    @keyframes rotation {
        0% {
            --gradient-angle: 0deg;
        }
        100% {
            --gradient-angle: 360deg;
        }
    }
    
    /* SCROLLBAR */
    ::-webkit-scrollbar {
        background-color: #0e4b50;
        width: 7px;
    }
    
    ::-webkit-scrollbar-thumb {
        background-color: #0038ad;
    }
    
    /* CONTENT */
    .header-easy-difficult {
        display: flex;
        flex-direction: row;
        justify-content: center;
        padding-top: 10px;
        width: 100%;
        height: 40px;
    
        font-size: 30px;
        color: #0038ad;
        font-weight: bold;
        font-family: 'Kanit', sans-serif;
        letter-spacing: .1em;
        filter: brightness(300%);
    
        user-select: none;
    }
    
    
    .text-modal-window-easy-difficult {
        padding: 10px 15px 15px;
    
        font-family: 'Montserrat', sans-serif;
        font-size: 16px;
        color: #c1c1c1;;
        font-weight: bold;
        text-align: justify;
    }
    
    /* BUTTON CLOSE */
    .container-btn {
        display: flex;
        justify-content: space-around;
        align-items: center;
        max-height: 100px;
        padding-top: 20px;
        font-family: 'Raleway', sans-serif;
    }
    
    .close-btn{
        height: 50px;
        width: 100px;
        background-color: #050801;
        color: #03e9f4;
        font-weight: bold;
        border: none;
        border-radius: 5px;
        letter-spacing: 4px;
        overflow: hidden;
        transition: 0.5s;
        cursor: pointer;
    }
    
    .close-btn:hover{
        background: #03e9f4;
        color: #050801;
        box-shadow: 0 0 5px #03e9f4,
        0 0 25px red,
        0 0 25px darkred;
        /*0 0 25px #03e9f4;*/
        /*0 0 50px #03e9f4,*/
        /*0 0 200px #03e9f4;*/
        -webkit-box-reflect:below 1px linear-gradient(transparent, #0005);
    }
    
    /* BUTTON NEXT */
    .next-btn{
        height: 50px;
        width: 100px;
        background-color: #050801;
        color: #03e9f4;
        font-weight: bold;
        border: none;
        border-radius: 5px;
        letter-spacing: 4px;
        overflow: hidden;
        transition: 0.5s;
        cursor: pointer;
    }
    
    .next-btn:hover{
        background: #03e9f4;
        color: #050801;
        box-shadow: 0 0 5px #03e9f4,
        0 0 25px #03e9f4,
        0 0 25px #03e9f4;
        /*0 0 50px #03e9f4,*/
        /*0 0 200px #03e9f4;*/
        -webkit-box-reflect:below 1px linear-gradient(transparent, #0005);
    }
    
    /* ---> my css below <--- */
    
    .modal-content {
        overflow-y: auto;
        max-height: 100%;
    }
    
    .container-btn {
        margin-bottom: 50px;
    }
    <div class="container-modal-window-easy-difficult">
        <div class="modal-window-easy-difficult">
            <div class="modal-content">
                <div class="header-easy-difficult">EASY</div>
                <div class="content-wrapper">
                    <div class="text-modal-window-easy-difficult">
                        The Easy difficulty level on our website is the perfect starting point for those who are just
                        beginning
                        their journey into the world of tasks and challenges. Here, you will find puzzles and tasks that
                        provide an
                        inspiring challenge but won't be overly difficult. With this level of difficulty, you can
                        familiarize
                        yourself with basic concepts and patterns, which will gradually help you develop your skills and
                        move on to
                        more serious challenges. Raise the bar of your knowledge with ease and confidence as you prepare for
                        more
                        complex trials ahead.
                        Lorem ipsum dolor sit, amet consectetur adipisicing elit. Modi tempore quod laudantium debitis
                        consectetur suscipit nostrum nesciunt, id rerum, eaque atque, sequi hic molestiae unde! Nulla
                        cupiditate voluptatum eaque quos!
                        Sapiente dignissimos cum tempore consequatur. Sequi veritatis sit voluptatum iure? Doloribus
                        aperiam, illum dolore, itaque ad velit iure neque quis architecto voluptatum exercitationem eius
                        dolorum mollitia voluptate voluptatem quam incidunt!
                        Amet, sit natus! Minima optio cumque animi omnis facere pariatur officia voluptate magni odio totam,
                        esse quia nulla saepe modi. Esse, eaque vitae obcaecati nihil autem nesciunt eos et harum!
                        Deleniti quibusdam eligendi ratione ducimus temporibus, alias officia adipisci excepturi quod
                        commodi. Ullam vel reprehenderit eligendi? Reiciendis, voluptates? Minus porro eligendi modi quos a
                        ea, corrupti error veritatis tenetur cum?
                        Deleniti repudiandae commodi eum ducimus. Debitis quam cupiditate optio natus, asperiores dolorum.
                        Ducimus magni culpa rerum. Illo excepturi, expedita provident nesciunt est harum molestiae, iure
                        corrupti, porro explicabo impedit ad.
                        Fugiat repellat laborum nemo facere enim commodi velit ut quam quidem porro. A suscipit architecto
                        quo repellat amet dolorem, nulla, ducimus enim animi vel dicta corporis. Sequi saepe aliquam
                        repellendus.
                        Qui, iste exercitationem, explicabo ab sequi ex odio ipsum hic deleniti soluta quibusdam officia
                        voluptas tempore. Quo cum doloribus assumenda reiciendis, dignissimos, ex necessitatibus nesciunt,
                        inventore totam dolorem numquam excepturi?
                        Nobis itaque dolor quam officia, aspernatur hic aliquid. Quod saepe, eius repellat ut quos officiis
                        quae, quia a, mollitia non unde recusandae? Adipisci incidunt placeat dicta esse hic. Hic, rem?
                        Molestiae ipsa architecto placeat quibusdam eius illum velit totam, laboriosam accusamus, quas ab.
                        Facere quia hic alias! Laborum id necessitatibus ex aut sunt eius incidunt, deleniti nostrum quo
                        voluptatem minus.
                        Dolore fugiat veniam nostrum corrupti voluptas! Voluptatibus magnam quo illum nam, veritatis
                        perferendis dignissimos omnis quibusdam reprehenderit aperiam nemo sunt assumenda iure sequi impedit
                        porro consequatur fuga inventore? Eveniet, culpa.
                    </div>
                </div>
                <div class="container-btn">
                    <button class="close-btn">CLOSE</button>
                    <button class="next-btn">NEXT</button>
                </div>
            </div>
        </div>
    </div>

    • 0

相关问题

  • 具有非均匀背景的块内的渐变边框

  • 离开页脚

  • 如何将三个字段的数据收集到一封电子邮件中?

  • Html 元素刚从父元素中出来

  • 如何在css中制作这个背景?

  • 如何制作带有斜条纹的背景?

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5