<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body{
background-color: navy;
}
#box{
background-color: red;
width: 100px;
height: 100px;
border: 5px solid orange;
border-radius: 12px;
transition: width 2s cubic-bezier(1,1.72,0,-0.39),
left 2s cubic-bezier(.79,-0.39,.79,1.63);
position: relative;
left: 0px;
}
</style>
</head>
<body>
<button id="goBtn">Go</button>
<hr />
<div id="box">Box</div>
<script>
// DOM - Document Object Model
let goBtn = document.getElementById("goBtn");
let box = document.getElementById("box");
console.log(goBtn);
console.dir(box);
console.dir(goBtn);
goBtn.style.backgroundColor = "Yellow";
goBtn.style.height = "40px";
goBtn.style.width = "60px";
// goBtn 클릭하면 box속성 변경
goBtn.onclick = function() {
box.style.width = "150px";
box.style.left = "400px";
};
goBtn.onmouseout = function() {
box.style.width = "100px";
box.style.left = "0";
};
</script>
</body>
</html>
'2022 SW전문인재양성사업 > 웹 퍼블리싱' 카테고리의 다른 글
시맨틱 태그 만들기 (0) | 2022.07.26 |
---|---|
Node.Js와 계산기 만들기 (0) | 2022.07.26 |
CSS 기초 (1) (0) | 2022.07.26 |
HTML5 기초 (6) - 간단한 게시판 만들기 (0) | 2022.07.26 |
HTML5 기초 (5) - 이력서 만들기 (0) | 2022.07.26 |