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

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);
}
你可以尝试在里面添加一个额外的包装。
.modal-window-easy-difficult在我的例子中是
.modal-content并在那里添加
overflow-y: auto:完整代码: