Родитель, который .p
должен иметь overflow: hidden;
, .content
должен иметь overflow: auto;
, чтобы иметь возможность прокручивать внутри требуемого элемента, и здесь часть, с которой вы можете играть.
по горизонтали .large {width: 2000px; height: 100%;}
вам нужно дать фиксированную ширину
по вертикали .large {height: 2000px; width: 100%;}
вы должны дать фиксированная высота
Первый заход с горизонтальная прокрутка
.p {
display: flex;
background: blue;
padding: 10px;
overflow: hidden;
width: 400px;
height: 300px;
}
.aside {
background: green;
flex: 0 0 100px;
margin-right: 10px;
}
.content {
padding: 10px;
flex-grow: 1;
background: purple;
overflow: auto;
}
.large {
background: orange;
height: 100%;
width: 2000px;
}
<div class="p">
<div class="aside">
aside (fix width)
</div>
<div class="content">
<div class="large">
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
</div>
</div>
</div>
Второй подход с вертикальной прокруткой
.p {
display: flex;
background: blue;
padding: 10px;
overflow: hidden;
width: 400px;
height: 300px;
}
.aside {
background: green;
flex: 0 0 100px;
margin-right: 10px;
}
.content {
padding: 10px;
flex-grow: 1;
background: purple;
overflow: auto;
}
.large {
background: orange;
height: auto;
width: 100%;
}
<div class="p">
<div class="aside">
aside (fix width)
</div>
<div class="content">
<div class="large">
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
large content (need scrollbar)
</div>
</div>
</div>