본문 바로가기

카테고리 없음

TIL(Today I Learn) 작성 시작

CSS 속성 선택자로 적용하는 방법

 

 

형태 설명
선택자[속성] 특정한 속성이 있는 태그 선택
선택자[속성=값] 특정한 속성 내부 값이 특정 값과 같은 태그 선택

 

<!DOCTYPE html>
<html>
    <head>
        <title>CSS - 속성 선택자로 적용하기</title>
    </head>
    <style>
        input[type="text"] {
            background: red;
        }
        input[type="password"] {
            background: blue;
        }
    </style>
<body>
    <form>
        <input type="text">
        <input type="password">
    </form>
</body>
</html>