
💡 헤더셀은 제목이기 때문에 글씨가 굵음체이다
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
<tr>
<td>Row 1, Cell 1</td>
<td>Row 1, Cell 2</td>
<td>Row 1, Cell 3</td>
</tr>
<tr>
<td>Row 2, Cell 1</td>
<td>Row 2, Cell 2</td>
<td>Row 2, Cell 3</td>
</tr>
</table>
결과 : 아래의 그림같이 테이블요소를 사용하면 행,열 정리만 될뿐 줄이 그어져있지 않다.

table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
color: black;
}
결과 : 아래와 같이 표안에 선이 생겼다

table {
border-collapse: collapse;
}
table {
border-collapse: separate;
}
/* 테이블의 전체 테두리 설정 */
table {
border: 2px solid #333;
border-collapse: collapse;
}
/* 각 셀의 테두리와 내부 여백 설정 */
th, td {
border: 1px solid #ccc;
padding: 10px;
text-align: center;
}
/* 헤더 셀 스타일 */
th {
background-color: #4CAF50;
color: white;
}
/* 짝수 행 배경색 설정 */
tr:nth-child(even) {
background-color: #f2f2f2;
}
/* 홀수 행 배경색 설정 */
tr:nth-child(odd) {
background-color: #ffffff;
}
/* 마우스를 올렸을 때 행 배경색 변경 */
tr:hover {
background-color: #ddd;
결과 : 마우스를 행에 올릴시 색상변경 확인가능

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Styled Table</title>
<style>
table {
width: 100%;
border: 2px solid #333;
border-collapse: collapse;
}
th, td {
border: 1px solid #ccc;
padding: 10px;
text-align: center;
}
th {
background-color: #4CAF50;
color: white;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
tr:nth-child(odd) {
background-color: #ffffff;
}
tr:hover {
background-color: #ddd;
}
</style>
</head>
<body>
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
<tr>
<td>Row 1, Cell 1</td>
<td>Row 1, Cell 2</td>
<td>Row 1, Cell 3</td>
</tr>
<tr>
<td>Row 2, Cell 1</td>
<td>Row 2, Cell 2</td>
<td>Row 2, Cell 3</td>
</tr>
</table>
</body>
</html>