์ฐธ๊ณ ๋ก Vue.js์ ๋ํด์ ์ ๋ชจ๋ฆ ๋๋ค.
์๋ฌด๊ฑฐ๋ ๋ง ํด๋ณด๋ ์ค์ด๊ณ ์ณ์ ์ ๋ณด์ธ์ง ์ ๋ ๋ชจ๋ฆ ๋๋ค!
์ปค์๋ฅผ ๋๋ฉด ๋ฒํผ์ ์์ด
๋ค๋ฅธ ์์ผ๋ก ๋ฐ๋๋ ๊ฒ์
๋ง๋ค์ด๋ณผ ๊ฒ์ด๋ค.
1. ์คํํ๋ฉด
2. HelloView.vue
๋ฒํผ ํด๋์ค๋ฅผ ๋จผ์ ๋ง๋ค์ด์ค๋๋ค.
<template>
<div class="main-view">
<button class="btn" > Click </button>
</div>
</template>
์ ์ฒด ํ๋ฉด ๊ตฌ์ฑ์ ์ด๋ ๊ฒ ํ์ต๋๋ค.
<style scoped> ์ ์ฝ๋
.main-view {
position: relative;
width: 100vw;
height: 100vh;
background-color: lemonchiffon;
}
๋ฒํผ์ ์์น๋ ์ค์์ ์์นํ๋๋ก ๋ฐฐ์นํ์ต๋๋ค. ๋ฐฐ๊ฒฝ์์ ๋ธ๋, ํ ์คํธ ์ปฌ๋ฌ๋ ํ์์์ ๋๋ค.
<style scoped> ์ ์ฝ๋
.btn{
position: absolute;
width: 80px;
height: 50px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 20px;
color: white;
background-color: black;
cursor: pointer;
}
:hover๋ ํฐ์น์คํฌ๋ฆฐ์ผ ๋ ์๋ํ์ง ์์ ์ ์๋ค. ์๋๋ฉด :hover๋ ๋ง์ฐ์ค๋ฅผ ์ฌ๋ ธ์ ๋๋ง ๋ฐ์ํ๋ ์คํ์ผ์ด๊ธฐ ๋๋ฌธ์ด๋ค. ๋ฐฐ๊ฒฝ์(background)์ ์ง๋ถํ์์ด๊ณ , ํ ์คํธ ์ปฌ๋ฌ(color)๋ ๋์ผํ๊ฒ ํ์ดํธ๋ก ํ๋ค. border๋ ํ ๋๋ฆฌ๋ฅผ ๋ํ๋ด๋๋ฐ, ์๋์ฒ๋ผ ์ค์ ์ ์ํด์ฃผ๋ฉด ํ ๋๋ฆฌ๋ ๊ฒ์์์ผ๋ก ๋ํ๋๋ค. 3px๋ ์ ์ ๊ตต๊ธฐ์ด๊ณ solid๋ ์ ์ ํํ๋ก ๊ทธ๋ฅ ์ผ์ง์ ์ ์ ํํ๋ค. ๊ทธ๋ฆฌ๊ณ ์์ ์ฝ๋๋ฅผ ์ ์ด์ฃผ๋ฉด ๋๋ค. pointer๋ ๋ฒํผ์ ์ปค์๋ฅผ ๋๋ฉด ๊ฒ์ง ๋ชจ์์ ์ ํํ๋ ํํ๋ก ๋ฐ๋๋๋ก ํ๋ค.
<style scoped> ์ ์ฝ๋
.btn:hover {
background-color: #ed3597;
color: white;
border: 3px solid #ed3597;
cursor:pointer;
}