[THU]2021-11-11 TIL

MINBOKยท2021๋…„ 11์›” 11์ผ
1

๋ฉ‹์Ÿ์ด์‚ฌ์ž์ฒ˜๋Ÿผ

๋ชฉ๋ก ๋ณด๊ธฐ
4/19
post-custom-banner

์˜ค๋Š˜๋ถ€ํ„ฐ ํ‚ฅ๋ณต์‹ฑ์„ ์‹œ์ž‘ํ–ˆ๋‹ค.
๋„ˆ๋ฌด ์žฌ๋ฐŒ๋‹ค ์ง„์งœ.
์˜ค๋žœ๋งŒ์— ๋ฏธํŠธ๋ž‘ ์ƒŒ๋“œ๋ฐฑ์น˜๋‹ˆ๊นŒ ์ŠคํŠธ๋ ˆ์Šค๊ฐ€
๋‹ค ํ’€๋ฆฌ๋Š” ๊ธฐ๋ถ„์ด๋‹ค. ์—ด์‹ฌํžˆ ๋‹ค๋…€์•ผ์ง€๐Ÿ˜Š

์•„ ๊ทธ๋ฆฌ๊ณ  ๋ฉ‹์‚ฌ ์บ๋ฆญํ„ฐ ๊ฒฝ์ง„๋Œ€ํšŒ์—์„œ ๋ฐ›์€
์„ ๋ฌผ๋„ ๋„์ฐฉํ–ˆ๋‹ค.
๋…ธํŠธ๋ถ ํŒŒ์šฐ์น˜๋งŒ ์˜ฌ ์ค„ ์•Œ์•˜๋Š”๋ฐ ์—ด์‡ ๊ณ ๋ฆฌ, ์Šคํ‹ฐ์ปค, ์†์ฝ”๋”ฉํ•˜๊ธฐ ์ข‹์•„๋ณด์ด๋Š” ๊ณต์ฑ… ๋‘ ๊ถŒ๋„ ๊ฐ™์ด ์™”๋‹ค. ๊ท€์—ฝ๋‹น ๐Ÿ˜˜

CSS

๐Ÿ”ท Box Model

  • box-sizing : ๋ฐ•์Šคํฌ๊ธฐ์— ๋Œ€ํ•œ ๊ธฐ์ค€์„ ์ •ํ•จ

1. box-sizing: content-box (๊ธฐ๋ณธ๊ฐ’)

.box {
	box-sizing: content-box;
	width: 400px;
	height: 400px; 
	padding: 10px;
	border: 3px solid black;
	margin: 10px;
}

๋ฐ•์Šค์˜ ํฌ๊ธฐ๊ฐ€ width, height์™€ ๊ฐ™์Œ
โ– ๋ฐ•์Šค, padding, border, margin์„ ํ•ฉ์นœ ์ด ๋„“์ด๋Š” width 446px

2. box-sizing: border-box (๊ธฐ๋ณธ๊ฐ’)

.box {
	box-sizing: content-box;
	width: 400px;
	height: 400px; 
	padding: 10px;
	border: 3px solid black;
	margin: 10px;

๋ฐ•์Šค์™€ border, padding๋ฅผ ํ•ฉ์ณ width 400px, height 400px
โ– ๋ฐ•์Šค, margin์„ ํ•ฉ์นœ ์ด ๋„“์ด๋Š” width 420px

  • display : ๋ฐ•์Šค์˜ ์„ฑ์งˆ์„ ์ง€์ •

1. inline: ์ค„๋ฐ”๊ฟˆX, width, height, margin-top,
margin-bottom ๊ฐ’ ์ง€์ •๋ถˆ๊ฐ€, ๋‚ด๋ถ€์— block ์š”์†Œ๊ฐ€ ์กด์žฌํ•  ์ˆ˜ ์—†์Œ

2. block: ํ•ญ์ƒ ์ค„๋ฐ”๊ฟˆO, ๋ชจ๋“  ๊ฐ’ ์ง€์ •๊ฐ€๋Šฅ,
๋‚ด๋ถ€์— inline์š”์†Œ ์กด์žฌ๊ฐ€๋Šฅ

3. inline-block: inline์ฒ˜๋Ÿผ ํ•œ์ค„์— ์—ฌ๋Ÿฌ ์š”์†Œ ์œ„์น˜๊ฐ€ ๊ฐ€๋Šฅํ•˜๋ฉฐ,
block์ฒ˜๋Ÿผ ๋ชจ๋“  ๊ฐ’์„ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Œ

The element generates a block element box that will be flowed with surrounding content as if it were a single inline box

4. contents: These elements don't produce a specific box by themselves. They are replaced by their pseudo-box and their child boxes

5. flex: The layout of items in one dimension
In the flex layout model, the children of a flex container can be laid out in any direction, and can โ€œflexโ€ their sizes, either growing to fill unused space or shrinking to avoid overflowing the parent.

6. grid: A two-dimensional grid system to CSS.
Grids can be used to lay out major page areas or small user interface elements
A grid is a set of intersecting horizontal and vertical lines defining columns and rows.
Elements can be placed onto the grid within these column and row lines.

๐Ÿ”ท Text

1. line-height : ๊ธ€์ž์˜ ๋†’์ด๋ฅผ ์ง€์ •ํ•จ
- normal : ๊ธฐ๋ณธ๊ฐ’, ํฐํŠธ์— ๋”ฐ๋ฅธ ๊ธฐ๋ณธ ๋†’์ด ์ œ๊ณต
- number: 2์€ ๊ธฐ๋ณธ font-size๊ฐ’์˜ ๋‘๋ฐฐ, ์†Œ์ˆ˜์ ์„ ์ง€์›
- px, em, % ๋“ฑ์˜ ๋‹จ์œ„ ์‚ฌ์šฉ๊ฐ€๋Šฅ

2. letter-spacing : ๊ธ€์ž์‚ฌ์ด ๊ฐ„๊ฒฉ ์กฐ์ •
- normal : ๊ธฐ๋ณธ๊ฐ’, ํฐํŠธ์— ๋”ฐ๋ฅธ ๊ธฐ๋ณธ ๊ฐ„๊ฒฉ ์ œ๊ณต
- px, em ๋“ฑ์˜ ๋‹จ์œ„ ์‚ฌ์šฉ๊ฐ€๋Šฅ

3. text-align : ํ…์ŠคํŠธ ์ •๋ ฌ
- left : ์™ผ์ชฝ ์ •๋ ฌ
- right: ์˜ค๋ฅธ์ชฝ ์ •๋ ฌ
- center: ์ค‘์•™ ์ •๋ ฌ
- justify: ์–‘์ชฝ ์ •๋ ฌ (์–‘์ชฝ์˜ ์—ฌ๋ฐฑ ํฌ๊ธฐ๋ฅผ ๋งž์ถค)

4. text-indent : ๋“ค์—ฌ์“ฐ๊ธฐ ๊ณต๊ฐ„ ์„ค์ •
- mm, cm, px, em, % ๋“ฑ์˜ ๋‹จ์œ„ ์‚ฌ์šฉ๊ฐ€๋Šฅ

5. text-decoration : ํ…์ŠคํŠธ๋ฅผ ๊พธ๋ฉฐ์คŒ,
๊พธ๋ฏธ๋Š” ์š”์†Œ๋กœ๋Š” ์ž˜ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ ,
a ํƒœ๊ทธ์˜ ๊ธฐ๋ณธ ์Šคํƒ€์ผ ์ œ๊ฑฐ์‹œ ํ™œ์šฉํ•จ

โœจ์ฐธ๊ณ : https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration

๐Ÿ”ท ๋ง ์ค„์ž„ํ‘œ ๊ตฌํ˜„ํ•˜๊ธฐ

p {
    width:500px;
    overflow:hidden;
    white-space:nowrap; 
    text-overflow:ellipsis; 
  }
  • overflow:hidden;
    : ์š”์†Œ๋ฅผ ๋„˜์–ด๊ฐ€๋Š” ์ปจํ…์ธ  ์ˆจ๊น
  • white-space:nowrap;
    : ํ…์ŠคํŠธ ๊ณต๋ฐฑ์—์„œ์˜ ์ค„๋ฐ”๊ฟˆ ์—ฌ๋ถ€ ์„ค์ •,
    nowrap์€ ๊ณต๋ฐฑ์„ ๋งŒ๋‚˜๋„ ์ค„๋ฐ”๊ฟˆX
  • text-overflow:ellipsis;
    : ์š”์†Œ๋ฅผ ๋„˜์–ด๊ฐ€๋Š” ํ…์ŠคํŠธ ๋ง ์ค„์ž„ ์ฒ˜๋ฆฌ
post-custom-banner

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