MapleStory Finger Point

๐Ÿ”ด WEB/Web ๊ฐœ๋…์ •๋ฆฌ

CSS Margins

HYEJU01 2024. 5. 10. 16:24

โœ”  Margins

  • margin-top
  • marign-right
  • margin-bottom
  • margin-left

 

  • margin : ์ƒ๋‹จ, ์˜ค๋ฅธ์ชฝ, ํ•˜๋‹จ, ์™ผ์ชฝ ;  -> 4๊ฐœ
  • margin : ์ƒ๋‹จ. ์˜ค๋ฅธ์ชฝ/์™ผ์ชฝ , ํ•˜๋‹จ; -> 3๊ฐœ
  • margin : ์œ„/์•„๋ž˜, ์˜ค๋ฅธ์ชฝ/์™ผ์ชฝ -> 2๊ฐœ

 

  • margin: auto;  -> ๊ฐ€๋กœ ์ค‘์•™์— ๋ฐฐ์น˜

 

  • margin-left: inherit;  -> ์ƒ์† , ์—ฌ๋ฐฑ ๊ฐ’์ด ์ƒ์œ„์š”์†Œ์—์„œ ์ƒ์†๋˜๋„๋ก ํ•จ

 

โœ” CSS Margin Collapse  :: ๋งˆ์ง„ ์ƒ์‡„

 

  • ๋ธ”๋ก๋ ˆ๋ฒจ ์š”์†Œ์ผ ๊ฒฝ์šฐ ์ ์šฉ๋จ. 
  • ๋งˆ์ง„ ๊ฐ’์ด 0์ด์–ด๋„ ์ ์šฉ
  • ์ขŒ์šฐ๋Š” ์ƒ์‡„ X ์ƒํ•˜๋งŒ ์ƒ์‡„ ์ ์šฉ O 

 

  • ์œ„์•„๋ž˜ margin ๊ฐ’ ๋™์ผํ•˜๊ณ , ๊ฒน์น˜๋Š” ๊ฒฝ์šฐ ๋ฐœ์ƒ 
    ๊ฒน์ณ์ง„ ๋งˆ์ง„ ๊ฐ’์„ ๋น„๊ตํ•ด์„œ ํฐ ๊ฐ’์œผ๋กœ ์ƒ์‡„ํ•ด์„œ ๋žœ๋”๋ง ํ•œ๋‹ค.

 

  • ๋†’์ด ์—†๋Š” (๋นˆ์š”์†Œ) ์ƒํƒœ์˜ ๋ธ”๋ก์š”์†Œ
    ์œ„ ์•„๋ž˜ ๊ฒฝ๊ณ„๊ฐ€ ์—†์–ด์„œ, ์ž์‹ ์˜ ์œ„ ์•„๋ž˜ ๋งˆ์ง„ ๊ฐ’์„ ๋น„๊ตํ•ด์„œ ๋” ํฐ ๊ฐ’์œผ๋กœ ์ƒ์‡„์‹œํ‚จ๋‹ค.

 

  • ๋ถ€๋ชจ๋ฐ•์Šค์™€ ์ฒซ,๋งˆ์ง€๋ง‰ ์ž์‹ ๋ฐ•์Šค์˜ ์ƒ,ํ•˜๋‹จ ๋งˆ์ง„์ด ๊ฒน์น ๋•Œ.

 

์ถœ์ฒ˜ :

 

CSS Margin Collapse

W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

www.w3schools.com

 

CSS ๋งˆ์ง„ ์ƒ์‡„(Margin-collapsing) ์›๋ฆฌ ์™„๋ฒฝ ์ดํ•ด

๋งˆ์ง„ ์ƒ์‡„๋Š” ํ”ํžˆ '๋งˆ์ง„ ๊ฒน์นจ ํ˜„์ƒ'์ด๋ผ๊ณ ๋„ ๋ถˆ๋ฆฝ๋‹ˆ๋‹ค. (ํ˜น์ž๋Š” '๋งˆ์ง„ ๋นก์นจ ํ˜„์ƒ'์ด๋ผ๊ณ ๋„ ํ•ฉ๋‹ˆ๋‹ค) ํ•˜์ง€๋งŒ ์ธ๊ณผ๊ด€๊ณ„๋กœ ๋ณผ ๋•Œ, ๋งˆ์ง„์ด ๊ฒน์น˜๊ฒŒ ๋˜๋ฉด ์ƒ์‡„๊ฐ€ ์ผ์–ด๋‚˜๊ธฐ ๋•Œ๋ฌธ์— ์˜๋ฏธ๊ถŒ์—์„œ๋Š” '๋งˆ์ง„ ์ƒ

velog.io