728x90
반응형
테이블 라이브러리(table library)인 데이터테이블(DataTables) 배경색(background) 및 테두리(boder) 변경 방법
[html]
<table id="myTable" class="display">
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Row 1 Data 1</td>
<td>Row 1 Data 2</td>
</tr>
<tr>
<td>Row 2 Data 1</td>
<td>Row 2 Data 2</td>
</tr>
<tr>
<td>Row 3 Data 1</td>
<td>Row 3 Data 2</td>
</tr>
<tr>
<td>Row 4 Data 1</td>
<td>Row 4 Data 2</td>
</tr>
</tbody>
</table>
[css]
html, body {
background: #ddd;
color: #333;
}
#myTable_wrapper .dataTables_length,
#myTable_wrapper .dataTables_filter {
padding-bottom: 1rem;
}
#myTable {
border: none; /* 테이블 최하단 테두리 제거 */
border-radius: 4px;
overflow: hidden;
background: #fff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
#myTable thead tr th {
border-bottom: none; /* thead 하단 테두리 제거 */
background: skyblue;
color: navy;
}
#myTable tbody tr td {
box-shadow: none; /* tbody의 배경색 제거 */
border-top: 1px solid skyblue; /* 열 사이 테두리 변경 */
}
#myTable tbody tr.even td {
background: rgba(0, 0, 0, 0.05); /* tbody의 짝수열 배경 삽입 */
}
[js]
let table = new DataTable('#myTable', {
// options
});
'Library' 카테고리의 다른 글
[Tabulator] 배경색(background) / 테두리(border) / 마우스오버(mouseover) 변경 (1) | 2023.09.17 |
---|---|
[slick] slider 실행 시 콜백(callback) 이벤트 (0) | 2023.07.26 |
[swiper] slide 실행 시 콜백(callback) 이벤트 (0) | 2023.07.19 |
[slick] slider에서 재생 / 정지 버튼 추가 (0) | 2023.06.22 |
[slick] slider에서 margin(여백) 만드는 법 (0) | 2023.05.31 |