<div class="wrap">
<div class="cont_select">
<div class="select_each">
<div class="scroll">
<table>
<caption class="hidden">table</caption>
<colgroup>
<col style="width: 85px;"/>
<col/>
</colgroup>
<thead>
<tr>
<th></th>
<th>Product Category</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td><span>Product Category 1</span></td>
</tr>
<tr>
<td></td>
<td><span>Product Category 2</span></td>
</tr>
<tr>
<td></td>
<td><span>Product Category 3</span></td>
</tr>
<tr>
<td></td>
<td><span>Product Category 4</span></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="select_all">
<div class="scroll">
<table>
<caption class="hidden">table2</caption>
<colgroup>
<col style="width: 85px;"/>
<col/>
</colgroup>
<thead>
<tr>
<th class="btn"><button type="button">Select All</button></th>
<th>Product</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td><span>Product1</span></td>
</tr>
<tr>
<td></td>
<td><span>Product2</span></td>
</tr>
<tr>
<td></td>
<td><span>Product3</span></td>
</tr>
<tr>
<td></td>
<td><span>Product4</span></td>
</tr>
<tr>
<td></td>
<td><span>Product5</span></td>
</tr>
<tr>
<td></td>
<td><span>Product6</span></td>
</tr>
<tr>
<td></td>
<td><span>Product7</span></td>
</tr>
<tr>
<td></td>
<td><span>Product8</span></td>
</tr>
<tr>
<td></td>
<td><span>Product9</span></td>
</tr>
<tr>
<td></td>
<td><span>Product10</span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
.wrap{
max-width: 1000px;
margin: 50px auto;
padding: 20px;
font-size: 14px;
}
/* content select */
.cont_select{
position: relative;
display: flex;
gap: 40px;
}
.cont_select [class*="select_"]{
width: calc((100% - 40px) / 2);
}
.cont_select .scroll{
max-height: 316px;
border: 1px solid #C9C9C9;
overflow-y: auto;
overflow-x: hidden;
}
.cont_select table{
position: relative;
width: 100%;
border-spacing: 0;
}
.cont_select thead{
position: sticky;
top: 0;
border-bottom: 1px solid #CDCDCD;
z-index: 5;
}
.cont_select th{
height: 32px;
padding: 10px 12px;
border-bottom: 1px solid #cdcdcd;
background-color: #f3f3f3;
font-weight: 700;
}
.cont_select th.btn{
padding: 10px 5px;
}
.cont_select th button{
position: relative;
border: none;
color: #000;
font-weight: 700;
cursor: pointer;
}
.cont_select th button::after{
content: "";
position: absolute;
left: 50%;
top: 90%;
transform: translate(-50%, -50%);
width: 85%;
height: 1px;
background-color: #000;
}
.cont_select tr+tr td{
border-top: 1px solid #CDCDCD;
}
.cont_select th.btn+th,
.cont_select td+td{
border-left: 1px solid #CDCDCD;
}
.cont_select .slds-form-element{
display: flex;
align-items: center;
justify-content: center;
min-height: 32px;
}
.cont_select td>span{
display: block;
padding: 6px;
}
.cont_select::after{
content: "";
width: 28px;
height: 28px;
position: absolute;
top: 10px;
left: 50%;
transform: translateX(-50%);
background-image: url("data:image/svg+xml,%3Csvg width='28' height='28' viewBox='0 0 28 28' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 5L14 14L5 23' stroke='%23C9C9C9'/%3E%3Cpath d='M14.5 5L23.5 14L14.5 23' stroke='%23C9C9C9'/%3E%3C/svg%3E");
background-repeat: no-repeat no-repeat;
background-position: center center;
background-size: cover;
}
.hidden {
position: absolute;
overflow: hidden;
padding: 0 !important;
margin: 0 !important;
width: 1px;
height: 1px;
line-height: 1px;
font-size: 1px;
border: 0;
clip: rect(0 0 0 0);
}
@media (max-width: 673px){
.cont_select{
flex-direction: column;
}
.cont_select [class*="select_"]{
width: 100%;
}
.cont_select .scroll {
max-height: 184px;
}
.cont_select:after{
top: 50%;
left: 50%;
transform: translate(-50%,-50%) rotate(90deg);
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.