Rumah > Soal Jawab > teks badan
P粉2698479972023-09-06 11:04:03
Menggunakan Flexbox akan membawa tuah kepada anda
.main-container { background-color: #ccc; padding: 1.0rem; width: 1200px; margin: 1.0rem 0 0 1.0rem; } .menu-grid { display: flex; flex-wrap: wrap; gap: 1.0rem; } .menu-grid > * { flex: 600px; } .left-menu { font-size: 1.25rem; } .right-menu { display: grid; background-color: white; grid-auto-columns: 65px; grid-auto-flow: column; grid-row-gap: 0.5rem; grid-column-gap: 0.75rem; } .right-item { background-color: #fff; text-align: center; min-width: 65px; border: 1px solid black; }
<div class="main-container"> <div class="menu-grid"> <div class="left-menu">Left</div> <div class="right-menu"> <div class="right-item">Item: 1</div> <div class="right-item">Item: 2</div> <div class="right-item">Item: 3</div> <div class="right-item">Item: 4</div> <div class="right-item">Item: 5</div> <div class="right-item">Item: 6</div> <div class="right-item">Item: 7</div> <div class="right-item">Item: 8</div> <div class="right-item">Item: 9</div> <div class="right-item">Item: 10</div> <div class="right-item">Item: 11</div> <div class="right-item">Item: 12</div> <div class="right-item">Item: 13</div> </div> </div> </div>