๐ ๐๏ธ ์์ ํ ๋ฐ์ํ๋ HTML+CSS ์คํฐ์ปค ๋ฉ๋ชจ
์คํฐ์ปค ๋ฉ๋ชจ์ ๋ชจ์๊ณผ ๋๋์ ์ฌํํ๊ธฐ ์ํด ๊ฐ์ฅ ์ค์ํ ๋ถ๋ถ์ ๊ณก๋ฅ ์ ์ฌ๋ฐ๋ฅด๊ฒ ๋ง๋๋ ๊ฒ์ด์์ต๋๋ค. ๋๋ ์ด๊ฒ์ ๋ฌ์ฑํ๊ธฐ ์ํด SVG์
clipPath
๋ฅผ ์ฌ์ฉํ์ต๋๋ค. ๊ณก๋ฅ ์ ์ง์ํ๋ ค๋ฉด ์ฝ๊ฐ์ ์กฐ๋ช
ํจ๊ณผ๋ฅผ ์ถ๊ฐํด์ผ ํ์ต๋๋ค. ์ ํ ๊ทธ๋ผ๋์ธํธ๋ก ์ด๊ฒ์ ๋ฌ์ฑํ์ต๋๋ค.ํ์ง๋ง ๊ฐ์ฅ ์ด๋ ค์ด ์ ์ ๊ทธ๋ฆผ์๋ฅผ ์ฌ๋ฐ๋ฅธ ๋ฐฉํฅ์ผ๋ก ๋ฐฐ์นํ๋ ๊ฒ์ด์์ต๋๋ค. ์คํฐ์ปค๊ฐ ์ค์ ๋ก ๋ฒฝ์ ๊ทธ๋ฆผ์๋ฅผ ๋๋ฆฌ์ฐ๋ ๊ฒ์ฒ๋ผ ๋ณด์ฌ์ผ ํ์ง๋ง ์คํฐ์ปค ๋ถ๋ถ์ด ๋ฒฝ์ ์ง์ ๋ฟ๊ธฐ ๋๋ฌธ์ ๊ทธ๋ฆผ์๋ฅผ ๋๋ฆฌ์ฐ์ง ์์์ผ ํฉ๋๋ค.
์๋ต์ฑ์ ๋ฐฑ๋ถ์จ ๋ฐ ์ ์ํ ๊ธ๊ผด ํฌ๊ธฐ๊ฐ ์๋ ํจ๋ฉ์ ์ฌ์ฉํ์ฌ ๋ฌ์ฑ๋ฉ๋๋ค. ๊ทธ๋ฆผ์ ํฌ๊ธฐ์ ์์น ์ง์ ๋ ๊ณ ๋ คํด์ผ ํฉ๋๋ค. ๋ฐฑ๋ถ์จ ๋จ์๋ก ์ธํด ์๋ก ๋ค๋ฅธ ๋ทฐํฌํธ์์ ๋ค๋ฅด๊ฒ ๋์ํ๊ธฐ ๋๋ฌธ์ ๋๋ค.
๋งํฌ์ ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
<div class="sticky-container">
<div class="sticky-outer">
<div class="sticky">
<svg width="0" height="0">
<defs>
<clipPath id="stickyClip" clipPathUnits="objectBoundingBox">
<path
d="M 0 0 Q 0 0.69, 0.03 0.96 0.03 0.96, 1 0.96 Q 0.96 0.69, 0.96 0 0.96 0, 0 0"
stroke-linejoin="round"
stroke-linecap="square"
/>
</clipPath>
</defs>
</svg>
<div class="sticky-content">
Hello! I'm a<br>
sticky note!
</div>
</div>
</div>
</div>
๋ค์์ CSS์ ๋๋ค.
/* Some positioning and ratios */
.sticky-container {
max-width: 270px;
position: relative;
}
.sticky-outer {
display: flex;
padding-top: 92.5925926%;
position: relative;
width: 100%;
}
.sticky {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
/* Shadow behind the sticky note */
.sticky:before {
box-shadow: -2px 2px 15px 0 rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 0.25);
content: '';
width: 90%;
left: 5px;
height: 83%;
position: absolute;
top: 30%;
}
/* The sticky note itself */
.sticky-content {
background: linear-gradient(
180deg,
rgba(187, 235, 255, 1) 0%,
rgba(187, 235, 255, 1) 12%,
rgba(170, 220, 241, 1) 75%,
rgba(195, 229, 244, 1) 100%
);
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Kalam', cursive;
font-size: 1rem;
clip-path: url(#stickyClip);
}
/* Add responsiveness */
@media screen and (min-width: 640px) {
.sticky:before {
height: 79%;
width: 90%;
}
.sticky-content {
font-size: 1.25rem;
}
}
@media screen and (min-width: 768px) {
.sticky:before {
height: 75%;
width: 90%;
}
.sticky-content {
font-size: 1.5rem;
}
}
@media screen and (min-width: 1024px) {
.sticky:before {
height: 73%;
width: 90%;
}
.sticky-content {
font-size: 1.875rem;
}
}
๊ทธ๊ฒ ๋ค์ผ, ์ข์ ์ฃผ๋ง ๋์ธ์!
์ฌ๊ฐ ์๊ฐ์ ๊ธฐ์ ๊ธฐ์ฌ๋ฅผ ์๋๋ค. ์ด ๊ฒ์๋ฌผ์ ์ฌ๋ฏธ์๊ฒ ์ฝ์ผ์ จ๋ค๋ฉด buying me a coffee์ ๊ณ ๋ คํ์ญ์์ค!
Reference
์ด ๋ฌธ์ ์ ๊ดํ์ฌ(๐ ๐๏ธ ์์ ํ ๋ฐ์ํ๋ HTML+CSS ์คํฐ์ปค ๋ฉ๋ชจ), ์ฐ๋ฆฌ๋ ์ด๊ณณ์์ ๋ ๋ง์ ์๋ฃ๋ฅผ ๋ฐ๊ฒฌํ๊ณ ๋งํฌ๋ฅผ ํด๋ฆญํ์ฌ ๋ณด์๋ค https://dev.to/thormeier/fully-responsive-html-css-sticky-note-4oklํ ์คํธ๋ฅผ ์์ ๋กญ๊ฒ ๊ณต์ ํ๊ฑฐ๋ ๋ณต์ฌํ ์ ์์ต๋๋ค.ํ์ง๋ง ์ด ๋ฌธ์์ URL์ ์ฐธ์กฐ URL๋ก ๋จ๊ฒจ ๋์ญ์์ค.
์ฐ์ํ ๊ฐ๋ฐ์ ์ฝํ ์ธ ๋ฐ๊ฒฌ์ ์ ๋ (Collection and Share based on the CC Protocol.)
์ข์ ์นํ์ด์ง ์ฆ๊ฒจ์ฐพ๊ธฐ
๊ฐ๋ฐ์ ์ฐ์ ์ฌ์ดํธ ์์ง
๊ฐ๋ฐ์๊ฐ ์์์ผ ํ ํ์ ์ฌ์ดํธ 100์ ์ถ์ฒ ์ฐ๋ฆฌ๋ ๋น์ ์ ์ํด 100๊ฐ์ ์์ฃผ ์ฌ์ฉํ๋ ๊ฐ๋ฐ์ ํ์ต ์ฌ์ดํธ๋ฅผ ์ ๋ฆฌํ์ต๋๋ค