[css] Pseudo Class Selector 가상클래스 선택자

su.zn·2023년 6월 11일

Pseudo Class Selector (가상클래스 선택자)

선택자 뒤에 :가상이벤트 를 붙이면 특정 이벤트에 따라 적용할 스타일을 선택할 수 있음

링크의 스타일 설정

visited

방문된 링크의 스타일 설정

active

활성화된 (클릭) 링크의 스타일 설정

hover

호버링된 (머무름) 링크의 스타일 설정

focus

포커스된 (tab키, 클릭으로 포커스) 링크의 스타일 설정

<예시>

<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <style>
            a:link{
                color:black;
            }
           a:visited{
            color:red;
           }
           a:active{
                color:green;
        }
        a:hover{
            color:yellow;
        }
        
        a:focus{
            color:white;
        }
        input:focus{
             background-color: black;
             color:white;
        }
        </style>
    </head>
    <body>
         <a href="https://opentutorials.org">방문함</a>
         <a href="https://a.a">방문안함</a>
         <input type="text">
    </body>
</html>

0개의 댓글