フレックスボックスを使用して、テキストコンテンツが長くなるにつれてスクロールできる列を作成したいと考えています。 私はより良い説明をするために基調講演で絵を描きました。ここで子どものフレックスボックス親のフィットテキストコンテンツ
私のコードでは、単にすべての要素がflexboxesであり、私の現在のコードです。 私はあなたが2件の観光名所する必要が
.app {
display: flex;
height: 100vh;
flex-direction: row;
}
.sidebar {
display:flex;
flex: 1;
}
.cv {
\t display: flex;
flex:5;
\t flex-direction: column;
\t margin:20px;
\t border: 1px solid lightgrey;
\t border-radius: 10px;
\t background-color: white;
\t overflow: scroll;
}
.header {
\t display: flex;
\t flex: 0 0 150px;
\t justify-content: center;
\t align-items: center;
\t font-size: 20px;
}
.section {
\t display: flex;
\t flex-direction: column;
\t border: 1px solid lightgrey;
\t margin: 10px;
\t border-radius: 10px;
}
.sectionHeader{
\t display: flex;
\t align-items: center;
\t font-size: 18px;
\t padding-left: 20px;
\t padding-top: 15px;
\t padding-bottom: 5px;
\t flex: 0 0 30px;
\t background-color: gray;
\t color:white;
\t font-weight: 700;
}
.sectionBody{
\t display: flex;
\t flex: 1;
\t padding: 20px;
}
<div class="app">
<div class="sidebar"></div>
<div class="cv">
\t <div class="header">Header</div>
\t <div class="section">
\t \t <div class="sectionHeader">Section Header</div>
\t \t <div class="sectionBody">LONG TEXT</div>
\t </div>
\t <div class="section">
\t \t <div class="sectionHeader">Section Header</div>
\t \t <div class="sectionBody">LONG TEXT</div>
\t </div>
</div>
</div>
スニペット:スクロール;特定の高さを.cvクラスに定義する –