pseudo-class

์ƒํƒœ์— ๋”ฐ๋ผ์„œ ์Šคํƒ€์ผ์„ ์ค„ ์ˆ˜ ์žˆ๋Š” Pseudo-class ์…€๋ ‰ํ„ฐ

<button class="btn"> ๊ตฌ๋งคํ•˜๊ธฐ</button>
<input class="input-test">
<a href="#" class="link-test">๋งํฌ</a>


.btn {
    padding: 15px;
    font-size: 20px;
    border: none;
    border-radius: 10px;
    background-color: coral;
    color: white;
    cursor: pointer;
}

.btn:hover {  /*๋งˆ์šฐ์Šค๋ฅผ ์˜ฌ๋ ค๋†“์„ ๋•Œ*/
    background-color: chocolate;

}
.btn:focus { /*ํด๋ฆญ ํ›„ ๊ณ„์† ํฌ์ปค์Šค ์ƒํƒœ์ผ ๋•Œ*/
    background-color: grey;

}
.btn:active {  /*ํด๋ฆญ ์ค‘์ผ ๋•Œ*/
    background-color: darkblue;
    border: 2px solid black;
}



.input-test{
    font-size: 20px;

}
.input-test:focus{
    border: 4px solid red;
}

.link-test {
    text-decoration: none;

}
.link-test:link {
    color: chocolate;
}

.link-test:visited {
    color: black;
}

๊ธฐํƒ€ ๋‹ค์–‘ํ•œ ๊ฐ€์ƒ ์„ ํƒ์ž

input ๋“ฑ์—๋„ ์ž์ฃผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค

์ธํ’‹์— ์ปค์„œ๊ฐ€ ์ฐํ˜€์žˆ์„ ๋•Œ ์ธํ’‹์— ์Šคํƒ€์ผ์„ ์ฃผ๊ณ  ์‹ถ์œผ๋ฉด ๋‹น์—ฐํžˆ :focus๋ฅผ ๋ถ™์ด๋ฉด ๋ฉ๋‹ˆ๋‹ค.

Last updated