๐ŸŽจCSS | ์ด๋ฏธ์ง€ ๋ฐฐ๊ฒฝ ์„ค์ •, box-shadow inset, ๋ฐฐ๊ฒฝ-border ์„ค์ •, reset.css

์›์˜ยท2023๋…„ 3์›” 6์ผ
0

์ด๋ฏธ์ง€ ๋ฐฐ๊ฒฝ ์„ค์ •

  • background-size: contain; : ์ด๋ฏธ์ง€๊ฐ€ ์ž˜๋ฆฌ๊ฑฐ๋‚˜ ์ฐŒ๊ทธ๋Ÿฌ์ง€์ง€ ์•Š๋Š” ํ•œ๋„ ๋‚ด์—์„œ ์ œ์ผ ํฌ๊ฒŒ ์„ค์ •, ์—ฌ๋ฐฑ ๋ฐœ์ƒ
    background-size: cover; : ์ด๋ฏธ์ง€๊ฐ€ ์ฐŒ๊ทธ๋Ÿฌ์ง€์ง€ ์•Š๋Š” ํ•œ๋„ ๋‚ด์—์„œ ์ œ์ผ ํฌ๊ฒŒ ์„ค์ • + ์ด๋ฏธ์ง€์˜ ๊ฐ€๋กœ์„ธ๋กœ๋น„ ๋งž์ถ”๊ธฐ ์œ„ํ•ด ์ด๋ฏธ์ง€๋ฅผ ์ž˜๋ผ๋‚ด์–ด ์—ฌ๋ฐฑ ๋ฐœ์ƒX

  • ๋ณดํ†ต ์ด๋ฏธ์ง€ ๋ฐ˜์‘ํ˜•์œผ๋กœ ์ง‘์–ด๋„ฃ์„ ๋•Œ

div {
	background-image: url("img.png");
	background-position: center;
	background-size: cover
	background-repeat: no-repeat;
}
div {
	background: url("img.png") center/cover no-repeat;
}

box-shadow ์†์„ฑ inset

  • ๊ทธ๋ฆผ์ž๊ฐ€ ์š”์†Œ์˜ ํ…Œ๋‘๋ฆฌ ์•ˆ, ๋ฐฐ๊ฒฝ์ƒ‰ ์œ„์— ๊ทธ๋ ค์ง

์˜ˆ์‹œ

.box1 {
	box-shadow: inset 20px 20px #4a5568;
}
.box2 {
	box-shadow: inset 20px -20px #4a5568;
}
.box3 {
	box-shadow: inset -20px 20px #4a5568;
}
.box4 {
	box-shadow: inset -20px -20px #4a5568;
}


๋ฐฐ๊ฒฝ ์ ์šฉ

๋ฐฐ๊ฒฝ์„ ๊ธ€์ž ๋ชจ์–‘๋Œ€๋กœ ์ ์šฉ

.box {
	background-image: url('img.png');
	color: transparent;
	background-clip: text;
	-webkit-background-clip: text;
}

๋ฐฐ๊ฒฝ์„ border ์•ˆ์œผ๋กœ ์ ์šฉ

.box{
	background-clip : padding-box;
}

๋ฐฐ๊ฒฝ์„ ์ปจํ…์ธ ๋งŒ ๊ฐ์‹ธ๊ฒŒ ์ ์šฉ

.box{
	background-clip: content-box;
}

์ฐธ๊ณ ์‚ฌํ•ญ

๐Ÿ’ก๋‹จ์ถ•์†์„ฑ์€ ๊ฐœ๋ณ„์†์„ฑ ์œ„์— ์ฃผ์–ด์•ผ ํ•จ

div {
	background-clip : padding-box;
	background: lightgoldenrodyellow;
}

์œ„ ์ˆœ์„œ๋กœ ์ฃผ๋ฉด ๋‹จ์ถ•์†์„ฑbackground์—์„œ ๊ฐœ๋ณ„์†์„ฑbackground-clip ์†์„ฑ ์ค€ ๊ฒƒ์ด ์‚ฌ๋ผ์ง
์œ„ ์˜ˆ์‹œ์™€ ๋ฐ˜๋Œ€์ˆœ์„œ๋กœ ์ž‘์„ฑํ•ด์•ผ ํ•จ


reset.css

  • ์ดˆ๊ธฐํ™”ํ•˜๋Š” css (ex. body์˜ margin์„ 0์œผ๋กœ ์„ค์ •)
  • ํšŒ์‚ฌ์— ๋“ค์–ด๊ฐ€๋ฉด ํšŒ์‚ฌ์—์„œ ์ œ๊ณตํ•ด์ฃผ๋Š” ๊ฒฝ์šฐ ๋งŽ์Œ
  • ๊ฐœ์ธ ํ”„๋กœ์ ํŠธ ํ•  ๋•Œ๋Š” normalize.css + ์ž์‹ ๋งŒ์˜ ๊ฒƒ ์ถ”๊ฐ€ํ•ด ์‚ฌ์šฉ
profile
ํ™”์ดํŒ…~~^ใ…^/

0๊ฐœ์˜ ๋Œ“๊ธ€