๐ŸŒˆCSS:Box Model

hojuneยท2023๋…„ 8์›” 13์ผ

Web Development

๋ชฉ๋ก ๋ณด๊ธฐ
7/34

Property


Width & height (๊ฐ€๋กœ & ์„ธ๋กœ)


Border (ํ…Œ๋‘๋ฆฌ)

a.width(๋‘๊ป˜)

b.color

c.style 

d.box sizing (๋งž์ถค)

e.radius (๋ชจ์„œ๋ฆฌ ๊ณก๋ฅ )


#one 
{
    background-color: antiquewhite;
    border-width: 5px;
    border-color: black;
    border-style: dashed;
    box-sizing: border-box;
}
#three 
{
    border: medium soild green;
    border-left-style: dotted;
    border-radius: 20%;
}

ํ•œ๋ฒˆ์— ๋„ฃ์„ ์ˆ˜ ์žˆ๊ณ  radius๋Š” %,px๋“ฑ ์—ฌ๋Ÿฌ ๋‹จ์œ„ ์‚ฌ์šฉ ๊ฐ€๋Šฅ

Padding(ํ…Œ๋‘๋ฆฌ์™€ ๋‚ด์šฉ ์‚ฌ์ด์˜ ๊ณต๊ฐ„)

shorthand
  

/* apply to all four sides */

padding: 20px;

/* vertical / horizontal */

padding : 5px  10px;

/* top / horizontal / bottom */

padding : 1px 2px 2px;

/* top / right / bottom / left */

padding : 5px 1px 0 2px;

Margin(ํ…Œ๋‘๋ฆฌ ๋ฐ”๊นฅ ๊ณต๊ฐ„)

padding๊ณผ ๋™์ผ


Display Property

1.Inline

2.Block

3.Inline-Block

4.none



css

h1{display : line;}



display property๊ฐ€ ๋ฌด์—‡์ธ์ง€์— ๋”ฐ๋ผ width,height,
  
margin,border,padding ์ ์šฉ๋˜๋Š”๊ฒŒ ๋‹ค๋ฆ„

์ด ๋ถ€๋ถ„์—์„œ 1,2,3๋ฒˆ์ด ์ฐจ์ด๋ฅผ ๋ณด์ž„

CSS Units (๋‹จ์œ„)

Relative-EM,REM,VH,VW,%,etc.


EM- ๋ถ€๋ชจ ์š”์†Œ์˜ ํฌ๊ธฐ์— ๋Œ€ํ•ด ์ƒ๋Œ€์ ์ธ ํฌ๊ธฐ๋ฅผ ๊ฐ–์Œ

ex) 2EM์€ ๋ถ€๋ชจ ์š”์†Œ์˜ ํฌ๊ธฐ์— ๋Œ€ํ•ด 2๋ฐฐ์˜ ํฌ๊ธฐ๋ฅผ ๊ฐ–์Œ



REM- Html ์š”์†Œ์— ๋”ฐ๋ผ ์ƒ๋Œ€์ ์ธ ํฌ๊ธฐ๋ฅผ ๊ฐ–์Œ

Absolute-PX,PT,CM,IN,MM

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