<!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8"> <!-- 장치크기 자동 확대 --> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>과제 페이지</title> <style> body { text-align: center; transition: background-color 0.3s, color 0.3s; /* 부드러운 변화 효과 */ } .light-mode { background-color: #ffffff; color: #000000; } .dark-mode { background-color: #333333; color: #ffffff; } .container { margin-top: 20vh; } button { padding: 10px 20px; font-size: 16px; cursor: pointer; border: none; border-radius: 5px; margin-top: 20px; } .light-mode button { background-color: #000; color: #fff; } .dark-mode button { background-color: #fff; color: #000; } table { margin: 20px auto; border-collapse: separate; /* 개별 셀 분리 */ border-spacing: 0; width: 50%; border-radius: 10px; border: 1px solid #000; /* 테이블 전체 테두리 */ overflow: hidden; } th, td { border: 1px solid #000; padding: 10px; text-align: center; } th { background-color: navy; color: white; font-weight: bold; } .dark-mode th, .dark-mode td { border: 1px solid #fff; } a { color: inherit; /* 기본 텍스트 색상 유지 */ text-decoration: none; /* 밑줄 제거 */ } a:hover { text-decoration: underline; /* 마우스 호버 시 밑줄 추가 */ color: dodgerblue; /* URL 텍스트 색상 변경 */ } </style> </head> <body class="light-mode"> <div class="container"> <h1>안녕하세요! </h1> <h3>23200671 조성동 과제 제출 입니다.</h3> <button onclick="toggleTheme()">다크 모드 전환</button> <table> <tr> <th>name</th> <th>url</th> </tr> <tr> <td>code 저장소</td> <td><a href="https://gitea.icurfer.com/sdjo/html-test" target="_blank">https://gitea.icurfer.com/sdjo/html-test</a></td> </tr> </table> </div> <script> function toggleTheme() { const body = document.body; body.classList.toggle("dark-mode"); body.classList.toggle("light-mode"); const button = document.querySelector("button"); if (body.classList.contains("dark-mode")) { button.textContent = "라이트 모드 전환"; } else { button.textContent = "다크 모드 전환"; } } </script> </body> </html>