我有一个带有侧边栏的基本仪表板设置,我正在try 让内容区域中的元素在X轴上有一个溢出滚动.
但是,如果使用溢出滚动,则会使其父级溢出.
我已经try 了柔性和网格模板柱(1FR 5Fr).
我期望从侧边栏获得的行为(在我的示例中没有完全编码)是clamp(fixedminval, 1fr, fixedmaxval)
.
下面是一个例子:
https://codepen.io/fdsaazeazfazreazrazr/pen/ExJZRzg个
<div class="content">
<div class="sidebar">sidebar</div>
<div class="container">
<p>
how can I make this element stop making its parent overflow and have its own X axis scrollbar // how can I make this element stop making its parent overflow and have its own X axis scrollbar // how can I make this element stop making its parent overflow and have its own X axis scrollbar
</p>
<div>
</div>
<style>
.content {
display:flex;
min-height: 100vh;
width: 100vw;
max-width: 100vw;
}
.sidebar {
flex-grow: 1;
flex-basis: 0;
background: grey;
}
.container {
flex-grow: 5;
flex-basis: 0;
margin: 0;
background: salmon;
}
p {
max-width: 100%;
white-space: nowrap;
overflow: scroll;
}
</style>
我try 了很多东西,特别是宽度和最大宽度,但没有找到一个方法,使它的工作