간단한 메모장

* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: Arial, sans-serif; background-color: #f4f4f9; display: flex; justify-content: center; align-items: center; height: 100vh; } .container { width: 300px; background-color: white; padding: 20px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); border-radius: 10px; } h1 { text-align: center; margin-bottom: 20px; } textarea { width: 100%; height: 200px; padding: 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 16px; margin-bottom: 10px; resize: none; } button { width: 48%; padding: 10px; border: none; background-color: #007bff; color: white; font-size: 16px; border-radius: 5px; cursor: pointer; } button#clearButton { background-color: #ff4d4d; } button:hover { opacity: 0.8; } button:active { transform: scale(0.98); } document.addEventListener("DOMContentLoaded", function() { const note = document.getElementById("note"); const saveButton = document.getElementById("saveButton"); const clearButton = document.getElementById("clearButton"); // 저장된 메모 불러오기 note.value = localStorage.getItem("savedNote") || ""; // 메모 저장 버튼 클릭 시 saveButton.addEventListener("click", function() { localStorage.setItem("savedNote", note.value); alert("메모가 저장되었습니다."); }); // 메모 초기화 버튼 클릭 시 clearButton.addEventListener("click", function() { note.value = ""; localStorage.removeItem("savedNote"); alert("메모가 초기화되었습니다."); }); });