๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
CODING/WEB

[CSS] ๊ทธ๋ผ๋ฐ์ด์…˜ ํšจ๊ณผ

by ๋ฐํ†จ๋งนํ†จ 2020. 11. 9.
728x90
728x90

๐Ÿ”Ž ๊ทธ๋ผ๋ฐ์ด์…˜ 

- ํฌ๊ธฐ๊ฐ€ ์—†๋Š” ๋ฐฐ๊ฒฝ์ด๋ฏธ์ง€ 

- backgroud-image๋‚˜ background์†์„ฑ์—์„œ ์‚ฌ์šฉ

- ์†์„ฑ์€ ํ‘œ์ค€ํ™” ๋จ

- ๊ตฌํ˜• ๋ชจ๋˜ ๋ธŒ๋ผ์šฐ์ € ( ์‚ฌํŒŒ๋ฆฌ 5.1 ~ 6.0 & ํŒŒ์ด์–ดํญ์Šค 3.6 ~ 15 & ์˜คํŽ˜๋ผ 11.1 ~ 12.0 )์€ ๊ฐ๊ฐ ๋งž๊ฒŒ ๋ธŒ๋ผ์šฐ์ € ์ ‘๋‘์‚ฌ๋ฅผ ๋ถ™์—ฌ์•ผ ๋™์ž‘ํ•จ

 ๋ธŒ๋ผ์šฐ์ € ๋ฒ„์ ผ ์ ‘๋‘์‚ฌ
๐Ÿ“Œ์‚ฌํŒŒ๋ฆฌ 5.1 ~ 6.0   -webkit-
๐Ÿ“ŒํŒŒ์ด์–ดํญ์Šค 3.6 ~ 15  -moz-
๐Ÿ“Œ์˜คํŽ˜๋ผ 11.1 ~ 12.0 -o-

 

๐Ÿ”Ž ์„ ํ˜• ๊ทธ๋ผ๋ฐ์ด์…˜ 

- ์ˆ˜์ง or ์ˆ˜ํ‰ or ๋Œ€๊ฐ์„  ๋ฐฉํ–ฅ์œผ๋กœ ์ƒ‰์ƒ์ด ๋ณ€ํ•˜๋Š” ๊ฒƒ

- ๋ฐฉํ–ฅ๊ณผ ์ƒ‰์ƒ์ด ํ•„์š”

 

[ ๋ฐฉํ–ฅ ] 

ver. ํ‘œ์ค€ ๊ตฌ๋ฌธ

ex ) backgroud: linear-gradient( to ๋„์ฐฉ ๋ฐฉํ–ฅ, ์ถœ๋ฐœ ์ƒ‰, ๋„์ฐฉ ์ƒ‰)

๋”๋ณด๊ธฐ

background: blue;
background: -webkit-linear-gradient(left top, blue, white);

background: -moz-linear-gradient(right bottom, blue, white);

background: -o-linear-gradient(right bottom, blue, white);

background: linear-gradient(to right bottom, blue, white);

 

๐Ÿ– ์ ‘๋‘์‚ฌ๋งˆ๋‹ค ๋ฐฉํ–ฅ ์†์„ฑ๊ฐ’์„ ์‚ฌ์šฉํ•˜๋Š” ๊ธฐ์ค€์ด ๋‹ค๋ฆ„.

[ ๊ฐ๋„ ] 

 

- ๊ทธ๋ผ๋ฐ์ด์…˜์ด ๋๋‚˜๋Š” ๊ฐ๋„ / ๋‹จ์œ„ : deg

ex ) background: linear-gradient(45deg, #ff0000, #ffffff); 

ex ) 

๋”๋ณด๊ธฐ

background: -webkit-linear-gradient(45deg, #ff0000, #ffffff); 

background: -moz-linear-gradient(45deg, #ff0000, #ffffff); 

background: -o-linear-gradient(45deg, #ff0000, #ffffff); 

 

๐Ÿ”Ž ์›ํ˜• ๊ทธ๋ผ๋ฐ์ด์…˜

 

- ์›์ด๋‚˜ ํƒ€์›์˜ ์ค‘์‹ ๋ถ€ํ„ฐ ๋™์‹ฌ์›์„ ๊ทธ๋ฆฌ๋ฉฐ ๋ฐ”๊นฅ ๋ฐฉํ–ฅ์œผ๋กœ ์ƒ‰์ƒ์ด ๋ฐ”๋€Œ๋Š” ๊ทธ๋ผ๋ฐ์ด์…˜

- ์ƒ‰์ƒ์ด ๋ฐ”๋€Œ๊ธฐ ์‹œ์ž‘ํ•˜๋Š” ์›์˜ ์ค‘์‹ฌ๊ณผ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•˜๊ณ  ๊ทธ๋ผ๋ฐ์ด์…˜ ๋ชจ์–‘์„ ์ง€์ •ํ•ด์•ผํ•จ

 

[ ๋ชจ์–‘ ] 

 

- ์›ํ˜• ๊ทธ๋ผ๋ฐ์ด์…˜์—์„œ ๋งŒ๋“ค์–ด์ง€๋Š” ๋ชจ์–‘์€ circle(์›ํ˜•)๊ณผ ellipse(ํƒ€์›ํ˜•)

- defalut๊ฐ’ : ellipse (ํƒ€์›ํ˜•)

 

ex ) background:radial-gradient(white, yellow, red); OR background:radial-gradient(circle, white, yellow, red);

 

[ ์œ„์น˜ ]

- ๊ทธ๋ผ๋ฐ์ด์…˜์ด ์‹œ์ž‘ํ•˜๋Š” ์›์˜ ์ค‘์‹ฌ ์ง€์ •

 

[ํ‘œ์ค€ ๊ตฌ๋ฌธ]

๋ชจ์–‘ โžก๏ธ ํฌ๊ธฐ โžก๏ธ at + ์œ„์น˜ ๊ฐ’

 

ex) background: radial-gradient(circle at 10% 10%,white,blue);

 

[์ ‘๋‘์‚ฌ ๊ตฌ๋ฌธ]

at ์—†์ด ๊ตฌ๋ฌธ์˜ ๋งจ ์•ž์— ์œ„์น˜๊ฐ’ ์ง€์ •

 

ex) background: radial-gradient(10% 10%, circle, white,blue);

 

์œ„์˜ ์ฝ”๋“œ ๊ฒฐ๊ณผ ๊ฐ’

- ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ’ : ํ‚ค์›Œ๋“œ (left, center, right ไธญ 1 โž• top, center, bottom ไธญ 1) or ๋ฐฑ๋ถ„์œจ (์œ„์˜ ์˜ˆ์‹œ์ฒ˜๋Ÿผ)

 

 

[ ํฌ๊ธฐ ]

- ๊ทธ๋ผ๋ฐ์ด์…˜ ์›์˜ ํฌ๊ธฐ ์ง€์ •

 

[์ž‘์€ ๊ฒƒ๋ถ€ํ„ฐ ์ ์  ์ปค์ง]

 

๐Ÿ“ closest-side

์›ํ˜• ๊ทธ๋ž˜๋””์–ธํŠธ์˜ ํฌ๊ธฐ๊ฐ€ ๊ฐ€์žฅ ๊ฐ€๊นŒ์šด ๋ฉด์— ๋‹ฟ์„ ๋งŒํผ์˜ ํฌ๊ธฐ

๐Ÿ”ป

๐Ÿ“ closest-corner

์›ํ˜• ๊ทธ๋ž˜๋””์–ธํŠธ์˜ ํฌ๊ธฐ๊ฐ€ ๊ฐ€์žฅ ๊ฐ€๊นŒ์šด ๋ชจ์„œ๋ฆฌ์— ๋‹ฟ์„ ๋งŒํผ์˜ ํฌ๊ธฐ

๐Ÿ”ป

๐Ÿ“ farthest-side

์›ํ˜• ๊ทธ๋ž˜๋””์–ธํŠธ์˜ ํฌ๊ธฐ๊ฐ€ ๊ฐ€์žฅ ๋จผ ๋ฉด์— ๋‹ฟ์„ ๋งŒํผ์˜ ํฌ๊ธฐ

๐Ÿ”ป

๐Ÿ“farthest-corner

์›ํ˜• ๊ทธ๋ž˜๋””์–ธํŠธ์˜ ํฌ๊ธฐ๊ฐ€ ๊ฐ€์žฅ ๋จผ ๋ชจ์„œ๋ฆฌ์— ๋‹ฟ์„ ๋งŒํผ์˜ ํฌ๊ธฐ๋กœ ์„ค์ •

 

[ ๊ทธ๋ผ๋ฐ์ด์…˜ ๋ฐ˜๋ณต ]

 

- ๋‹จ์ˆœํžˆ ๊ทธ๋ผ๋ฐ์ด์…˜์„ ๋ฐ˜๋ณตํ•˜๋Š” ๊ฒŒ ์•„๋‹Œ ํŒจํ„ด์„ ๋งŒ๋“ค์–ด ๋ฐ˜๋ณต์‹œํ‚ด 

 

ex) background: repeating-linear-gradient(yellow, yellow 20px, red 20px, red 40px);

 

 

 

 

 

 

728x90

๋Œ“๊ธ€