position
static
์์๋ฅผ ์ผ๋ฐ์ ์ธ ๋ฌธ์ ํ๋ฆ์ ๋ฐฐ์น
top, right, bottom, left, z-index ์์ฑ์ด ์๋ฌด๋ฐ ์ํฅ X
float
๊ธฐ์ค์
์๋ ์๋ ์์น๋ฅผ ๊ธฐ์ค์ ์์ ์ด๋
๋ฌธ์์ ์์์ ์ ๊ธฐ์ค์ ์ผ๋ก ํ์ฌ ์ด๋
absolute๋ฅผ ์ค ๊ฒฝ์ฐ width๋ฅผ ์ง์ ํ์ง ์์ผ๋ฉด ํญ์ content ํฌ๊ธฐ๋งํผ ํฌ๊ธฐ๋ฅผ ์ก์
visibility
.hidden {
visibility: hidden;
}
z-index
position ์์ฑ์ด static์ด ์๋ ์์์ ๊ทธ ์์ ์์์ Z์ถ ์์๋ฅผ ์ง์
<style type="text/css">
.box {
width: 150px;
height: 150px;
border: 3px dotted gray;
}
.absolute-box {
width: 100px;
height: 100px;
position: absolute;
}
.yellow {
background-color: yellow;
z-index: 1000; /* position์ด static์ด๋ฉด ์ ์ฉ ์ ๋จ */
}
.orange {
background-color: orange;
left: 100px;
top: 100px;
z-index: 100; /* position์ด static์ด๋ฉด ์ ์ฉ ์ ๋จ */
}
.green {
background-color: green;
left: 150px;
top: 150px;
z-index: 500; /* position์ด static์ด๋ฉด ์ ์ฉ ์ ๋จ */
}
.blue {
background-color: blue;
left: 180px;
top: 120px;
z-index: 10; /* position์ด static์ด๋ฉด ์ ์ฉ ์ ๋จ */
}
</style>
์ด๋ก์์ ์์ผ๋ก ๋นผ๊ณ ์ถ๋ค๋ฉด?? satic์ด๋ฉด ์ ๋จ
z-index ๋ฅผ ์ด์ฉํ์ฌ ์ซ์๊ฐ ํฌ๋ฉด ํด ์๋ก ์๋ก ์น๊ณ ์ฌ๋ผ์จ๋ค.
clip
์์์ ์ด๋ ๋ถ๋ถ์ด ๋ณด์ด๋์ง๋ฅผ ์ ์ํ๋ค. position์ด absolute, fixed ๋ง ๊ฐ๋ฅ
.img {
position: absolute;
top: 80px;
left: 420px;
clip: rect(20px, 220px, 220px, 20px); /* 450 * 300 ์ด๋ฏธ์ง */
/* top, right, botto, left */
}
columns
.box1 {
columns: 3; /* 3๋จ */
margin: 30px;
}
.box2 {
columns: 200px; /* ์ต์ ํฌ๊ธฐ ์ง์ */
margin: 30px;
}
.box3 {
columns: 200px 5; /* ๋จ ์ต์ ๋จ ์ */
margin: 30px;
}
'๐ปProgramming > ๐ฉโ๐จHTML&CSS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[HTML&CSS] 04. ๋ ์ด์์๊ณผ ํฌ์ง์ ๋ - Grid (0) | 2022.09.15 |
---|---|
[HTML&CSS] 04. ๋ ์ด์์๊ณผ ํฌ์ง์ ๋ - flex (0) | 2022.09.15 |
[CSS] 04. ๋ ์ด์์ ํฌ์ง์ ๋ - float (0) | 2022.09.14 |
[css] 04. ๋ ์ด์์ ํฌ์ง์ ๋ - margin ๊ฒน์นจ ํ์ (0) | 2022.09.14 |
[CSS] 04. ๋ ์ด์์ ํฌ์ง์ ๋ (0) | 2022.09.14 |