본문으로 바로가기



태그의 속성을 선택하여 CSS의 속성을 설정하는 법을 배워보겠습니다.


<코드>


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
 
<style>
    
    input {
        color:blue;
        font-size:30px;
    }
    
    input[type=text]
    {
        color:red;
        font-size:50px;
    }
    
    input[type=password]
    {
        color:green;
        font-size:10px;
    }
    
    
</style>
 
 
</head>
<body>
 
    <input type="tel"/><br/><br/>
    <input type="text"/><br/><br/>                                  
    <input type="password"/><br/><br/>
    
</body>
</html>
cs



style 태그를 보면 3개의 설정이 되어있습니다. input , input[type = text ] , input[type=password]

input : input 태그에 디자인을 이렇게 하겠다.

input[type=text] : input 태그의 type 속성이 text 인 녀석은 디자인을 이렇게 하겠다. 

input[type=password] :  input 태그의 type 속성이 password 인 녀석은 디자인을 이렇게 하겠다. 


참고로 CSS의 경우 순차적으로 스타일이 디자인이 됩니다.

input {} 

input<type=text] {}가 있다면 

먼저 input의 모든 태그는 css 속성이 바뀌고

다음 input<type=text] 인 태그의 속성이 바뀝니다. 


<결과>