SyntaxHighlighter.all(); [CSS] 속성1- url(), display(block, inline, inline-block), visibility, opacity :: 게을러지고 싶어 부지런한 개발자

url() 속성

-Background-img속성의 속성값으로 많이 사용됨. 

 

1
background-image:url('http://www.test.jpg');

 

display 속성

-화면에 어떻게 보이는지를 설정하는 속성 

-다양한 속성값이 있지만 display 속성으로 주로 몇 가지만 많이 사용됨

 

1) display: block  : 위아래 정렬  (블록을 쌓는 것처럼 개행이 저절로 되어 아래로 붙는 요소)

    (ex. <div>, <p>, <li> ) 

2) display: inline : 옆정렬 (옆으로 붙여짐); 높이는 최소값 

   (ex. <span>, <img> )

3) display: inline-block : inline 처럼 옆정렬도 되지만, block이 가지는 높이 속성도 함께 가짐 

4) display: none : 화면에서 보이지 않게 함(공간차지도 없음)

    (visibility: hidden : 화면에서는 안보이지만 공간은 그대로 차지) 

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <style>
        body div:nth-child(1) {
            width:100px;
            height:100px;
            background-color:#ff0000;
            color:#ffffff;
            font-weight:bold;
            text-align:center;
        }
 
        body div:nth-child(2) {
            width:100px;
            height:100px;
            background-color:#00ff00;
            color:#ffffff;
            font-weight:bold;
            text-align:center;
        }
 
        body div:nth-child(3) {
            width:100px;
            height:100px;
            background-color:#0000ff;
            color:#ffffff;
            font-weight:bold;
            text-align:center;
        }
 
        body div:nth-child(4) {
            width:100px;
            height:100px;
            background-color:#ff0000;
            color:#ffffff;
            font-weight:bold;
            text-align:center;
        }
 
        body div:nth-child(5) {
            width:100px;
            height:100px;
            background-color:#00ff00;
            color:#ffffff;
            font-weight:bold;
            text-align:center;
            display:inline;  /* block 요소인 div태그를 inline 요소로 바꿈 */
            margin:10px 10px 10px 10px;
        }
 
        body div:nth-child(6) {
            width:100px;
            height:100px;
            background-color:#0000ff;
            color:#ffffff;
            font-weight:bold;
            text-align:center;
            display:inline;  /* block 요소인 div태그를 inline 요소로 바꿈 */
        }
        body div:nth-child(7) {
            width:100px;
            height:100px;
            background-color:#ff0000;
            color:#ffffff;
            font-weight:bold;
            text-align:center;
            display:none;  /* none: 화면에서 날려보내기 (공간마저도 없앰) */
        }
        body div:nth-child(8) {
            width:100px;
            height:100px;
            background-color:#00ff00;
            color:#ffffff;
            font-weight:bold;
            text-align:center;
            display:inline;    /* block 요소인 div태그를 inline 요소로 바꿈 */
        }
        body div:nth-child(9) {
            width:100px;
            height:100px;
            background-color:#0000ff;
            color:#ffffff;
            font-weight:bold;
            text-align:center;
            display:inline-block; /*inline-block으로 하면 옆정렬이 되면서 & block요소로써 갖는 100px의 height 속성 */
        }
    </style>
</head>
<body>
 
    <div>
        content1
    </div>
    <div>
        content2
    </div>
    <div>
        content3
    </div>
 
    <div>
        content4
    </div>
    <div>
        content5
    </div>
    <div>
        content6
    </div>
    <div>
        content7
    </div>
    <div>
        content8
    </div>
    <div>
        content9
    </div>
 
</body>
</html>
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

opacity 속성

-투명도를 나타냄

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
<style>
        ul li {
            display:inline-block;  /*옆정렬시킴. 이 속성이 없다면 위아래 정렬 되었을것*/
            width:200px; height:100px;
            text-align:center;
            background-color:#dddddd;
        }
 
        ul li:nth-child(2) {
            background-color:#dddddd;
            opacity:0.7;
        }
 
        ul li:nth-child(3) {
            background-color:#dddddd;
            opacity:0.4;  /* 낮을수록 투명도 높아짐 */
        }
    </style>
</head>
<body> 
    <ul>
        <li>우리나라 만세!!</li>
        <li>대한민국 만세!!</li>
        <li>KOREA FIGHTING!!</li>
    </ul>
</body>
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

 

+ Recent posts