๐Ÿ’ป Programming/CSS

[CSS] 15. Paddings ( ํŒจ๋”ฉ )

์ด๋ฒˆ์—๋Š” ํŒจ๋”ฉ์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ํŒจ๋”ฉ์€ ๋‚ด์šฉ๊ณผ ํ…Œ๋‘๋ฆฌ ์‚ฌ์ด์˜ ๊ฐ„๊ฒฉ์„ ๋งํ•ฉ๋‹ˆ๋‹ค. ์ด์ „์— ์—ฌ๋ฐฑ( ๋˜๋Š” ๋งˆ์ง„)์— ๋Œ€ํ•ด์„œ ๊ณต๋ถ€ํ•œ ์ ์ด ์žˆ์—ˆ์ฃ ? ๋งˆ์ง„๊ณผ ํŒจ๋”ฉ์˜ ์ฐจ์ด๊ฐ€ ๋ฌด์—‡์ธ์ง€ ์•„์‹œ๊ฒ ์ฃ ? ์ž˜ ๋ชจ๋ฅด์‹œ๊ฒ ๋‹ค๊ตฌ์š”? ๊ทธ๋Ÿผ ์ผ๋‹จ ํŒจ๋”ฉ ๊ด€๋ จ๋œ ์†์„ฑ์—๋Š” ์–ด๋–ค ๊ฒƒ๋“ค์ด ์žˆ๋Š”์ง€ ํ•œ๋ฒˆ ๋ณด๋„๋ก ํ•ฉ์‹œ๋‹ค. ํŒจ๋”ฉ ์†์„ฑ์— ๋Œ€ํ•œ ์†์„ฑ๊ฐ’์€ ๊ธธ์ด, ํผ์„ผํ‹ฐ์ง€, ๋˜๋Š” inherit์ž…๋‹ˆ๋‹ค.  inherit ๋Š” ๋ถ€๋ชจ์˜ ๊ทธ ๊ฐ’๊ณผ ๋™์ผํ•˜๊ฒŒ ํ•œ๋‹ค๋Š” ์˜๋ฏธ์ž…๋‹ˆ๋‹ค.ํผ์„ผํ‹ฐ์ง€ ๊ฐ’์ด ์‚ฌ์šฉ๋˜์—ˆ๋‹ค๋ฉด ๋‚ด์šฉ๋ฌผ์ด ๋“ค์–ด์žˆ๋Š” ์ปจํ…ํŠธ ๋ฐ•์Šค ์•ˆ์—์„œ์˜ ํผ์„ผํ‹ฐ์ง€์ž…๋‹ˆ๋‹ค.

๋‹ค์Œ์€ ํŒจ๋”ฉ๊ด€๋ จ ์†์„ฑ๋“ค ์ž…๋‹ˆ๋‹ค.

  • padding-bottom  

  • padding-top  

  • padding-left  

  • padding-right  

  • padding  

๊ทธ๋Ÿผ ์ด์ œ ๊ฐ ์†์„ฑ์— ๋Œ€ํ•œ ์˜ˆ์ œ๋ฅผ ๋ณด๋Ÿฌ ๊ฐ€ ๋ด…์‹œ๋‹ค~~~ Go Go Go ~


The padding-bottom Property:

The padding-bottom property sets the bottom padding (space) of an element. This can take a value in terms of length of %.

 

๋‹ค์Œ ์˜ˆ์ œ๋ฅผ ํ•œ๋ฒˆ ๋ณผ๊นŒ์š”. 

<p style="padding-bottom: 15px; border:1px solid black;">
This is a paragraph with a specified bottom padding
</p>

<p style="padding-bottom: 5%; border:1px solid black;">
This is another paragraph with a specified bottom padding in percent
</p>

 

๊ฒฐ๊ณผ๋Š” ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

This is a paragraph with a specified bottom padding

This is another paragraph with a specified bottom padding in percent

 


The padding-top Property:

The padding-top property sets the top padding (space) of an element. This can take a value in terms of length of %.

 

๋‹ค์Œ ์˜ˆ์ œํ•œ๋ฒˆ ๋ณผ๊นŒ์š”.

<p style="padding-top: 15px; border:1px solid black;">
This is a paragraph with a specified top padding
</p>

<p style="padding-top: 5%; border:1px solid black;">
This is another paragraph with a specified top padding in percent
</p>

 

๊ฒฐ๊ณผ๋Š” ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

This is a paragraph with a specified top padding

This is another paragraph with a specified top padding in percent

 


The padding-left Property:

The padding-left property sets the left padding (space) of an element. This can take a value in terms of length of %.

 

๋‹ค์Œ ์˜ˆ์ œ๋ฅผ ํ•œ๋ฒˆ ๋ณผ๊นŒ์š”.

<p style="padding-left: 15px; border:1px solid black;">
This is a paragraph with a specified left padding
</p>

<p style="padding-left: 15%; border:1px solid black;">
This is another paragraph with a specified left padding in percent
</p>

 

๊ฒฐ๊ณผ๋Š” ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

This is a paragraph with a specified left padding

This is another paragraph with a specified left padding in percent

 


The padding-right Property:

The padding-right property sets the right padding (space) of an element. This can take a value in terms of length of %.

 

๋‹ค์Œ ์˜ˆ์ œ๋ฅผ ํ•œ๋ฒˆ ๋ณผ๊นŒ์š”.

<p style="padding-right: 15px; border:1px solid black;">
This is a paragraph with a specified right padding
</p>

<p style="padding-right: 5%; border:1px solid black;">
This is another paragraph with a specified right padding in percent
</p>

 

๊ฒฐ๊ณผ๋Š” ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

This is a paragraph with a specified right padding

This is another paragraph with a specified right padding in percent

 


The padding Property:

The padding property sets the left, right, top and bottom padding (space) of an element. This can take a value in terms of length of %.

 

๋‹ค์Œ ์˜ˆ์ œ๋ฅผ ํ•œ๋ฒˆ ๋ณผ๊นŒ์š”.

<p style="padding: 15px; border:1px solid black;">
all four padding will be 15px
</p>

<p style="padding:10px 2%; border:1px solid black;">
top and bottom padding will be 10px, left and right padding will be 2% of the total width of the document.
</p>

<p style="padding: 10px 2% 10px; border:1px solid black;"> top padding will be 10px, left and right padding will be 2% of the total width of the document, bottom padding will be 10px </p>

<p style="padding: 10px 2% 10px 10px; border:1px solid black;"> top padding will be 10px, right padding will be 2% of the total width of the document, bottom padding and top padding will be 10px
</p>

 

๊ฒฐ๊ณผ๋Š” ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

all four paddings will be 15px

top and bottom paddings will be 10px, left and right paddings will be 2% of the total width of the document.

top padding will be 10px, left and right padding will be 2% of the total width of the document, bottom padding will be 10px

top padding will be 10px, right padding will be 2% of the total width of the document, bottom padding and top padding will be 10px

 

 

 

 

 

 

Reference :  http://www.tutorialspoint.com/css/css_padding.htm