์ด๋ฒˆ ํฌ์ŠคํŒ…์—์„œ๋Š” ๊ฐ์ข… HTML ํƒœ๊ทธ๋‚ด์—์„œ ์“ฐ์ด๋Š” ๋ฐฐ๊ฒฝ ๊ด€๋ จ ์†์„ฑ์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ๋ฐฐ๊ฒฝ๊ด€๋ จ ์†์„ฑ์—๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฒƒ๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค.

  •  background-color ๋Š” ๋ฐฐ๊ฒฝ ์ƒ‰์ƒ์„ ์„ค์ •ํ•˜๊ธฐ ์œ„ํ•œ ์†์„ฑ์ž…๋‹ˆ๋‹ค.

  •  background-image ๋Š” ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€๋ฅผ ์„ค์ •ํ•˜๊ธฐ ์œ„ํ•œ ์†์„ฑ์ž…๋‹ˆ๋‹ค.

  •  background-repeat ๋Š” ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€์˜ ๋ฐ˜๋ณต ์—ฌ๋ถ€๋ฅผ ์„ค์ •ํ•˜๊ธฐ ์œ„ํ•œ ์†์„ฑ์ž…๋‹ˆ๋‹ค.

  •  background-position ๋Š” ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€์˜ ์œ„์น˜๋ฅผ ์„ค์ •ํ•˜๊ธฐ ์œ„ํ•œ ์†์„ฑ์ž…๋‹ˆ๋‹ค.

  •  background-attachment ๋Š” ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€์˜ ์Šคํฌ๋กค๋ง์„ ์„ค์ •ํ•˜๊ธฐ ์œ„ํ•œ ์†์„ฑ์ž…๋‹ˆ๋‹ค.

  •  background property is used as shorthand to specify a number of other background properties.

 

๋ฐฐ๊ฒฝ ์ƒ‰ ์„ค์ •ํ•˜๊ธฐ

<p style="background-color:yellow;">
This text has a yellow background color.
</p>

This will produce following result:

This text has a yellow background color.

 

 

 

๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€ ์„ค์ •ํ•˜๊ธฐ

<table style="background-image:url(/images/pattern1.gif);">
<tr><td>
This table has background image set.
</td></tr>
</table>

 

 

๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€ ๋ฐ˜๋ณตํ•˜๊ธฐ

<table style="background-image:url(/images/pattern1.gif); 
              background-repeat: repeat;">
<tr><td>
This table has background image which repeats multiple times.
</td></tr>
</table>

 

์•„๋ž˜ ์˜ˆ์ œ๋Š” ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€๋ฅผ ์„ธ๋กœ๋กœ ๋ฐ˜๋ณต์‹œํ‚ค๋Š” ์˜ˆ์ œ์ž…๋‹ˆ๋‹ค.

<table style="background-image:url(/images/pattern1.gif); 
              background-repeat: repeat-y;">
<tr><td>
This table has background image set which will repeat vertically.
</td></tr>
</table>

 

์•„๋ž˜๋Š” ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€๋ฅผ ๊ฐ€๋กœ๋กœ ๋ฐ˜๋ณต์‹œํ‚ค๋Š” ์˜ˆ์ œ์ž…๋‹ˆ๋‹ค.

<table style="background-image:url(/images/pattern1.gif); 
              background-repeat: repeat-x;">
<tr><td>
This table has background image set which will repeat horizontally.
</td></tr>
</table>

 

 

๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€ ์œ„์น˜ ์„ค์ •ํ•˜๊ธฐ

๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€๋ฅผ ์™ผ์ชฝ์—์„œ 100 ํ”ฝ์…€ ๋–จ์–ด๋œจ๋ ค์„œ ์œ„์น˜์‹œํ‚ค๋Š” ์˜ˆ์ œ์ž…๋‹ˆ๋‹ค. 

<table style="background-image:url(/images/pattern1.gif); 
              background-position:100px;">
<tr><td>
Background image positioned 100 pixels away from the left.
</td></tr>
</table>

๋‹ค์œผ๋ฏ€ ์˜ˆ์ œ๋Š” ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€์˜ ์œ„์น˜๋ฅผ ์™ผ์ชฝ์—์„œ 100 ํ”ฝ์…€ ๊ทธ๋ฆฌ๊ณ  ์œ„์—์„œ 200 ํ”ฝ์…€ ๋–จ์–ด์ง„ ๊ณณ์— ์œ„์น˜์‹œํ‚ค๋Š” ์˜ˆ์ œ์ž…๋‹ˆ๋‹ค.

<table style="background-image:url(/images/pattern1.gif); 
              background-position:100px 200px;">
<tr><td>
This table has background image positioned 100
pixels away from the left and 200 pixels from the top.
</td></tr>
</table>

 

 

๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€ ๊ณ ์ • ๋˜๋Š” ์Šคํฌ๋กค ์—ฌ๋ถ€ ์„ค์ •ํ•˜๊ธฐ

Background attachment determines whether a background image is fixed or scrolls with the rest of the page.

 

์•„๋ž˜ ์˜ˆ์ œ๋Š” ๋ฐฐ๊ฒฝ์ด๋ฏธ์ง€๋ฅผ ๊ณ ์ •์‹œํ‚ค๋Š” ์˜ˆ์ œ์ž…๋‹ˆ๋‹ค. 

<p style="background-image:url(/images/pattern1.gif); 
              background-attachment:fixed;">
This parapgraph has fixed background image.
</p>

์ด๋ฒˆ ์˜ˆ์ œ๋Š” ์Šคํฌ๋กค๋ง์„ ํ•ด์ฃผ๋Š” ์˜ˆ์ œ๋„ค์š”.

<p style="background-image:url(/images/pattern1.gif); 
              background-attachment:scroll;">
This parapgraph has scrolling background image.
</p>

 

 

๋ฐฐ๊ฒฝ ์†์„ฑ ํ•œ๊บผ๋ฒˆ์— ์„ค์ •ํ•˜๊ธฐ

background ์†์„ฑ์€ ์—ฌ๋Ÿฌ๊ฐœ์˜ ๋ฐฐ๊ฒฝ๊ด€๋ จ ์†์„ฑ์„ ํ•œ๊บผ๋ฒˆ์— ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ค๋‹ˆ๋‹ค. 

<p style="background:url(/images/pattern1.gif) repeat fixed;">
This parapgraph has fixed repeated background image.
</p>

 

 

 

 

 

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