Β
Β
μνΈ μμ©μ μν κ°μν΄λμ€
:hover
μ¬μ©μκ° λ§μ°μ€λ₯Ό μμ μμ μ¬λ Έμ λ μ μ©λ©λλ€. μ€λ§νΈν°μ΄λ ν¨λ λ₯μ ν°μΉμ€ν¬λ¦° κΈ°κΈ°μμλ μ¬μ©μμ μκ°λ½μ΄ νΈλ²λλ μμ μ μ μ μκΈ° λλ¬Έμ λͺ¨λ°μΌ κΈ°κΈ°κ° λ§μμ§λ©΄μ μ μ μ¬μ© λΉλκ° μ€μ΄λλ κΈ°λ₯μ
λλ€.
:active
μ¬μ©μκ° μμλ₯Ό μ€νν λ(λ²νΌμ λλ₯΄κ±°λ λ§ν¬λ₯Ό ν΄λ¦ν λ) μ μ©λ©λλ€.
:focus
μμμ ν¬μ»€μ€κ° μμ λ μ μ©λ©λλ€. ν΄λ¦ν μ μλ μμλ νΌμ»¨νΈλ‘€(input, select λ±λ±)κ³Ό κ°μ΄ μνΈμμ© ν μ μλ λͺ¨λ μμμλ ν¬μ»€μ€κ° κ°λ₯ν©λλ€.
Β
<!DOCTYPE html> <html lang="ko"> <head> <title>λ²νΌ</title> <style> .btn { border: 4px solid palevioletred; border-radius: 4px; padding: 30px 60px; background: none; color: palevioletred; font-size: 32px; position: relative; overflow: hidden; cursor: pointer; transition: all .3s; } .btn:hover { color: white; border: 4px solid firebrick; } .btn:before { content: ""; position: absolute; bottom: 0; left: 0; width: 100%; height: 100%; background: palevioletred; z-index: -1; border-radius: 100px 100px 0px 0px; height: 0px; transition: all .3s; } .btn:hover:before { height: 120px; background: firebrick; } .btn:active { background-color:#000; } .box { border:1px solid palevioletred; display:block; height:40px; margin-bottom:10px; padding:0 5px; } .box:focus { background-color:rgba(0,0,255,0.1); } .box:focus::placeholder { color:red; font-weight:600; } </style> </head> <body> <input type="text" class="box" placeholder="Click Here!"> <button class="btn">Click Me!!</button> </body> </html>
Β
μ’ λ λ¨μν μμ
<!DOCTYPE html> <html lang="ko"> <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>hover, active, focus</title> <style> .one { background: blueviolet; width: 100px; height: 100px; transition: all 2s; } .one:hover { background:crimson; width: 200px; height: 200px; } .btn { border: 4px solid palevioletred; border-radius: 4px; padding: 30px 60px; background: none; color: palevioletred; font-size: 32px; transition: all .3s; } .btn:active { background-color: purple; color:white; } .box { transition: all .3s; } .box:focus { background: red; color: white; } </style> </head> <body> <div class="one"></div> <input type="text" class="box" placeholder="click here!"> <button class="btn">Click Me!!</button> </body> </html>