<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Div를 이용한 모던 테이블</title>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
color: #333;
background-color: #f5f7fa;
padding: 20px;
}
.table-container {
max-width: 1200px;
margin: 30px auto;
}
h1 {
text-align: center;
margin-bottom: 30px;
color: #2c3e50;
}
/* 테이블 스타일링 */
.div-table {
width: 100%;
background-color: #fff;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
border-radius: 10px;
overflow: hidden;
}
.div-table-header {
background-color: #4a6fa5;
color: white;
font-weight: bold;
}
.div-table-body {
background-color: white;
}
.div-table-row {
display: flex;
border-bottom: 1px solid #e0e0e0;
transition: all 0.3s ease;
}
.div-table-row:hover {
background-color: #f5f7fa;
}
.div-table-col {
flex: 1;
padding: 15px;
text-align: left;
display: flex;
align-items: center;
}
/* 헤더 스타일 */
.div-table-header .div-table-col {
padding: 18px 15px;
text-transform: uppercase;
letter-spacing: 0.5px;
font-size: 0.9em;
}
/* 상태 표시 스타일 */
.status {
padding: 5px 12px;
border-radius: 20px;
font-size: 0.8em;
font-weight: 500;
text-align: center;
}
.status.active {
background-color: #e3f7e8;
color: #2e7d32;
}
.status.inactive {
background-color: #ffebee;
color: #c62828;
}
.status.pending {
background-color: #fff8e1;
color: #ff8f00;
}
/* 반응형 디자인 */
@media screen and (max-width: 768px) {
.div-table-row {
flex-direction: column;
border-bottom: 2px solid #ddd;
padding: 10px 0;
}
.div-table-col {
padding: 8px 15px;
border-bottom: 1px solid #eee;
justify-content: space-between;
}
.div-table-col:before {
content: attr(data-label);
font-weight: bold;
color: #555;
margin-right: 10px;
}
.div-table-header {
display: none;
}
.status {
margin-left: auto;
}
}
</style>
</head>
<body>
<div class="table-container">
<h1>사원 정보 테이블</h1>
<div class="div-table">
<!-- 테이블 헤더 -->
<div class="div-table-header">
<div class="div-table-row">
<div class="div-table-col">이름</div>
<div class="div-table-col">직책</div>
<div class="div-table-col">부서</div>
<div class="div-table-col">이메일</div>
<div class="div-table-col">연락처</div>
<div class="div-table-col">상태</div>
</div>
</div>
<!-- 테이블 바디 -->
<div class="div-table-body">
<!-- 행 1 -->
<div class="div-table-row">
<div class="div-table-col" data-label="이름">
<div class="avatar">👨💼</div>
<div>김철수</div>
</div>
<div class="div-table-col" data-label="직책">과장</div>
<div class="div-table-col" data-label="부서">마케팅팀</div>
<div class="div-table-col" data-label="이메일">chulsoo.kim@company.com</div>
<div class="div-table-col" data-label="연락처">010-1234-5678</div>
<div class="div-table-col" data-label="상태"><span class="status active">활성</span></div>
</div>
<!-- 행 2 -->
<div class="div-table-row">
<div class="div-table-col" data-label="이름">
<div class="avatar">👩💼</div>
<div>이영희</div>
</div>
<div class="div-table-col" data-label="직책">대리</div>
<div class="div-table-col" data-label="부서">개발팀</div>
<div class="div-table-col" data-label="이메일">younghee.lee@company.com</div>
<div class="div-table-col" data-label="연락처">010-2345-6789</div>
<div class="div-table-col" data-label="상태"><span class="status inactive">휴가</span></div>
</div>
<!-- 행 3 -->
<div class="div-table-row">
<div class="div-table-col" data-label="이름">
<div class="avatar">🧑💼</div>
<div>박민수</div>
</div>
<div class="div-table-col" data-label="직책">사원</div>
<div class="div-table-col" data-label="부서">인사팀</div>
<div class="div-table-col" data-label="이메일">minsu.park@company.com</div>
<div class="div-table-col" data-label="연락처">010-3456-7890</div>
<div class="div-table-col" data-label="상태"><span class="status active">활성</span></div>
</div>
<!-- 행 4 -->
<div class="div-table-row">
<div class="div-table-col" data-label="이름">
<div class="avatar">👨💻</div>
<div>정태영</div>
</div>
<div class="div-table-col" data-label="직책">차장</div>
<div class="div-table-col" data-label="부서">기획팀</div>
<div class="div-table-col" data-label="이메일">taeyoung.jung@company.com</div>
<div class="div-table-col" data-label="연락처">010-4567-8901</div>
<div class="div-table-col" data-label="상태"><span class="status pending">승인대기</span></div>
</div>
</div>
</div>
</div>
</body>
</html>