๐Ÿ’ป FE/๐Ÿ“ HTML & CSS

[ HTML / CSS ] ์ธ๋ผ์ธ ์š”์†Œ & ๋ธ”๋ก ์š”์†Œ

Roy Miller 2023. 12. 8. 15:24

 

 

์ธ๋ผ์ธ ์š”์†Œ

ํ•„์š”ํ•œ ๋ถ€๋ถ„๋งŒ ๊ณต๊ฐ„ ์ฐจ์ง€.

์—ฐ์† ๋ฐฐ์น˜์‹œ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ€๋กœ๋กœ ๋‚˜๋ž€ํžˆ ๋ฐฐ์น˜๋จ.

์˜ˆ) <span>, <img> ๋“ฑ

 

 

๋ธ”๋ก ์š”์†Œ

๊ฐ€๋กœ๋กœ ๋ชจ๋‘ ์ฐจ์ง€.

์—ฐ์† ๋ฐฐ์น˜์‹œ ๊ธฐ๋ณธ์ ์œผ๋กœ ์•„๋ž˜์— ๋ฐฐ์น˜๋จ.

margin, padding, width, height ์„ค์ •๊ฐ€๋Šฅ. 

์˜ˆ) <p>, <div> ๋“ฑ

 

 

์š”์•ฝ

์ธ๋ผ์ธ ์š”์†Œ๋Š” ์ž๊ธฐ๋ถ€๋ถ„ ์กฐ๊ธˆ๋งŒ <------><--><----->์ด๋Ÿฐ ๋А๋‚Œ

๋ธ”๋ก ์š”์†Œ๋Š” ๊ฐ€๋กœ๋กœ ๊ฝ‰์ฐจ๋Š” ์ง์‚ฌ๊ฐํ˜• ๋А๋‚Œ์ด๋ผ ๋ณด๋ฉด ๋œ๋‹ค. 

 

์ธ๋ผ์ธ ์š”์†Œ๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•  ์ˆ˜ ์—†๋Š”๋ฐ, display: inline-block ์„ ์ง€์ •ํ•ด์ฃผ๋ฉด ํฌ๊ธฐ๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. 

๋ธ”๋ก ์š”์†Œ ์•ˆ์— ์ธ๋ผ์ธ ์š”์†Œ๋ฅผ ์‚ฝ์ž…ํ•˜์—ฌ ์ธ๋ผ์ธ ์š”์†Œ๋ฅผ ๊ด€๋ฆฌ ํ•  ์ˆ˜ ์žˆ๋‹ค.

 

 

์ฐธ๊ณ  

 

Inline-level content - MDN Web Docs Glossary: Definitions of Web-related terms | MDN

In CSS, content that participates in inline layout is called inline-level content. Most text sequences, replaced elements, and generated content are inline-level by default.

developer.mozilla.org

 

Block-level content - MDN Web Docs Glossary: Definitions of Web-related terms | MDN

In CSS, content that participates in block layout is called block-level content.

developer.mozilla.org

 


 

Inline formatting context - CSS: Cascading Style Sheets | MDN

This article explains the inline formatting context.

developer.mozilla.org

 

Block formatting context - Developer guides | MDN

A block formatting context (BFC) is a part of a visual CSS rendering of a web page. It's the region in which the layout of block boxes occurs and in which floats interact with other elements.

developer.mozilla.org

 


 

display - CSS: Cascading Style Sheets | MDN

The display CSS property sets whether an element is treated as a block or inline box and the layout used for its children, such as flow layout, grid or flex.

developer.mozilla.org