[CSS] inline, block, inline-block ๐Ÿ”ด

Narcokerยท2023๋…„ 5์›” 24์ผ
0

CSS

๋ชฉ๋ก ๋ณด๊ธฐ
13/40

๊ฐ ์š”์†Œ์— ํŠน์„ฑ์„ ์ดํ•ดํ•˜๊ณ  ํ•„์š”์—†๋Š” ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜์ง€ ๋ง ๊ฒƒ.
ex) div ์Šคํƒ€์ผ์— width: 100% ์ ์šฉํ•˜๋Š” ์ง“์€ ์ ˆ๋Œ€ํ•˜์ง€ ๋ง ๊ฒƒ.

inline ์š”์†Œ

  • ํ•œ์ค„์— ์—ฌ๋Ÿฌ๊ฐœ ๋ฐฐ์น˜
  • ๊ธฐ๋ณธ ๋„ˆ๋น„๊ฐ’์€ ์ปจํ…์ธ ์˜ ๋„ˆ๋น„๊ฐ’
  • ํฌ๊ธฐ๊ฐ’์„ ๊ฐ€์งˆ์ˆ˜ ์—†์Œ
  • ์ƒํ•˜ ๋งˆ์ง„์„ ๊ฐ€์งˆ ์ˆ˜ ์—†์Œ
  • span, a, small, bing, em, u ,s, del, br, q, b, strong, mark, sub, sup, video, audio
    - a๋Š” ๋ถ€๋ชจ์˜ ์†์„ฑ์„ ๋ฌผ๋ ค๋ฐ›์ง€ ์•Š๋Š”๋‹ค.

    ๐Ÿ”ด ๊ฐ€์ƒ์„ ํƒ์ž before, after ์š”์†Œ๋„ ๊ธฐ๋ณธ์ ์œผ๋กœ inline์ด๋‹ค.

block ์š”์†Œ

  • ํ•œ์ค„์— ํ•œ๊ฐœ๋งŒ ๋ฐฐ์น˜
  • ๊ธฐ๋ณธ ๋„ˆ๋น„ ๊ฐ’์€ 100%
  • ํฌ๊ธฐ๊ฐ’์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Œ
  • ์ƒํ•˜์ขŒ์šฐ ๋งˆ์ง„์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Œ
  • div, table, figure, figcaptioin, caption, header, nav, footer, section, article, aside, p, blockquote, ul, ol, li, td, th, form ,hr, h1~h6

inline-block ์š”์†Œ

  • ํ•œ์ค„์— ์—ฌ๋Ÿฌ๊ฐœ ๋ฐฐ์น˜
  • ๊ธฐ๋ณธ ๋„ˆ๋น„ ๊ฐ’์€ ์ปจํ…์ธ ์˜ ๋„ˆ๋น„๊ฐ’
  • ํฌ๊ธฐ๊ฐ’์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Œ
  • ๋งˆ์ง„ ๋ชจ๋‘ ํ—ˆ์šฉ
  • img, inputํƒœ๊ทธ๋“ค, button, fontawesome

    ๐Ÿ”ด position: absolute ๋˜๋Š” fixed๊ฐ€ ์ ์šฉ๋˜๋ฉด ๋ฌต์‹œ์ ์œผ๋กœ inline-block์ด ๋œ๋‹ค.
    ๐Ÿ”ด float ์†์„ฑ์ด ๋ถ€์—ฌ๋œ ์š”์†Œ๋Š” ๋ฌต์‹œ์ ์œผ๋กœ inline-block ์š”์†Œ๊ฐ€ ๋œ๋‹ค.
    ๐Ÿ”ด ์ •ํ™•ํ•˜๊ฒŒ๋Š” BFC๊ฐ€ ๋˜๋Š” ๊ฒƒ์ด๋‹ค.
    ์ฐธ๊ณ : [CSS] float ์™€ overflow์˜ ๊ด€๊ณ„ ๊ทธ๋ฆฌ๊ณ  BFC(Block Formatting Context)

display : ํƒœ๊ทธ ์†์„ฑ ๋ณ€๊ฒฝ

  • value: block, inline-block, inline, none, flex ๋“ฑ
  • ex) a { display: block} : a์˜ ํƒœ์ƒ์€ inline
profile
์—ด์ •, ๋ˆ๊ธฐ, ์ง‘๋…์˜ Frontend Developer

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