JavaScript/DOM
JS로 HTML Style다루기
yunajoe
2023. 1. 29. 20:31
style 프로퍼티
element.className
element.classList
add | 클래스 추가하기 |
remove | |
toggle | |
contains | |
replace |
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">v
<title>JS with Codeit</title>
<style>
.done {
opacity: 1;
text-decoration: line-through;
}
</style>
</head>
<body>
<div>
<h1 class="title">오늘 할 일</h1>
<ol id="today" class="list today">
<li class="item">자바스크립트 공부</li>
<li class="item">고양이 화장실 청소</li>
<li class="item">고양이 장난감 쇼핑</li>
</ol>
<h1 class="title">내일 할 일</h1>
<ol id="tomorrow" class="list tomorrow">
<li class="item">자바스크립트 공부</li>
<li class="item">뮤지컬 공연 예매</li>
<li class="item">유튜브 시청</li>
</ol>
</div>
<script src="./index.js"></script>
</body>
</html>