ȨÆäÀÌÁö¸¦ ¸¸µå´Âµ¥ »ç¿ëµÉ ¿©·¯ °¡Áö ½ºÅ¸ÀÏÀ» ¹Ì¸® Á¤ÀÇÇØ ³õ°í »ç¿ëÇÏ´Â ±â´É
ÀÏÀÏÀÌ ÆùÆ®ÀÇ ¼öÁ¤ÇØ ÁÖ´Â ÀÛ¾÷ÀÌ ÇÊ¿äÇѱßÀ»
½ºÅ¸ÀÏÀ» ÁöÁ¤Çؼ »ç¿ëÇÏ¸é °£ÆíÇÏ°Ô ÀÛ¾÷ ÇÒ ¼ö ÀÖ´Ù.
1. ½ºÅ¸ÀÏ ½ÃÆ®¸¦ Á¤ÀÇ Çϱâ
|
<HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=euc-kr"> <TITLE>CSS·Î ½ºÅ¸ÀÏ Á¤ÀÇÇϱâ</TITLE> <STYLE> H2 { color : red; font-size : 30pt; } P { color : blue; font-style : italic; } </STYLE> </HEAD> <BODY> <H2>Style Sheet</H2> <P> ½ºÅ¸ÀÏ ½ÃÆ®¸¦ CSS·Î Á¤ÀÇÇÏ¿´½À´Ï´Ù. </P> </BODY> </HTML> |
2. ½ºÅ¸ÀÏ½ÃÆ®¸¦ HTML ÅÂ±× ³»¿¡¼ Á¤ÀÇÇϱâ
|
<HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=euc-kr"> <TITLE>HTML ÅÂ±× ³»¿¡¼ ½ºÅ¸ÀÏ ½ÃÆ® Á¤ÀÇÇϱâ</TITLE> </HEAD> <BODY> <H2 style="color : red; font-size : 30pt;">Style Sheet</H2> <P style="color : blue; font-style : italic;"> ½ºÅ¸ÀÏ ½ÃÆ®°¡ Àû¿ëµÈ ¹®Àå </P> <P> ½ºÅ¸ÀÏ ½ÃÆ®°¡ ¾ø´Â ¹®Àå </P> </BODY> </HTML> |
3. ½ºÅ¸ÀÏ ½ÃÆ® ÆÄÀÏ ÁöÁ¤Çϱâ
[stylesheet.css]
|
H1.mystyle { color : blue; text-align : center; } .yourstyle { color : red; text-decoration : underline; } |
|
<HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=euc-kr"> <TITLE>½ºÅ¸ÀÏ ½ÃÆ® ÆÄÀÏ ÁöÁ¤Çϱâ</TITLE> <LINK rel="stylesheet" type="text/css" href="stylesheet.css"> </HEAD> <BODY> <H1>Ŭ·¡½º¸¦ ÁöÁ¤ÇÏÁö ¾ÊÀº ¹®Àå</H1> <H1 class="mystyle">mystyle Ŭ·¡½º¸¦ ÁöÁ¤ÇÑ ¹®Àå</H1> <H2 class="yourstyle">yourstyle Ŭ·¡½º¸¦ ÁöÁ¤ÇÑ ¹®Àå</H2> <P class="yourstyle">yourstyle Ŭ·¡½º¸¦ ÁöÁ¤ÇÑ ¹®Àå</P> </BODY> </HTML> |
4. ½ºÅ¸ÀÏ ½ÃÆ® ¼Ó¼º °è½ÂÇϱâ
|
<H3> ½ºÅ¸ÀÏ ½ÃÆ® ¼Ó¼º<H1>¼Ó¼º °è½ÂÇϱ⠿¬½À</H1></H3> |
À§ÀÇ ¿¹Á¦¿¡¼ <H3>űװ¡ »óÀ§ űװ¡ µÇ°í <H1>űװ¡ ÇÏÀ§Å±װ¡ µÈ´Ù.
µ¿ÀÏ ¼Ó¼ºÀÌ »ç¿ëµÉ °æ¿ì ÇÏÀ§ ÅÂ±× ¼Ó¼ºÀÌ ³ªÅ¸³´Ù.
¼Ó¼º°è½Â ¿¹Á¦
|
<HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=euc-kr"> <TITLE>½ºÅ¸ÀÏ ½ÃÆ® ¼Ó¼º °è½ÂÇϱâ</TITLE> <STYLE type="text/css"> BODY { background-color : yellow; color : blue; } H1 { color : white; text-align : center; } P { font-size : 15pt; background-color : black } </STYLE> </HEAD> <BODY> <!-- BODYÀÇ ¹è°æ»öÀ» °è½ÂµÇÁö¸¸ ±ÛÀÚ»öÀº white¸¦ »ç¿ëÇÑ´Ù. --> <H1>H1 ű׸¦ »ç¿ëÇÑ ¹®Àå</H1> <!-- BODYÀÇ ¸ðµç ½ºÅ¸ÀÏ ½ÃÆ® ¼Ó¼ºÀ» °è½ÂÇÏ¿© »ç¿ëÇÑ´Ù. --> <H2>H2 ű׸¦ »ç¿ëÇÑ ¹®Àå</H2> <!-- BODYÀÇ ±ÛÀÚ»öÀº °è½ÂµÇÁö¸¸ ¹è°æ»öÀº blackÀ» »ç¿ëÇÑ´Ù. --> <P> P ű׸¦ »ç¿ëÇÑ ¹®Àå</P>
</BODY> </HTML>
|
5. ½ºÅ¸ÀÏ ½ÃÆ® ID ÁöÁ¤Çϱâ
#z98y { letter-spacing: 0.3em }
H1#z98y { letter-spacing: 0.5em }
<P ID=z98y>Wide text</P>
|
6. Grouping
H1, H2, H3 { font-family: helvetica }
H1 {
font-weight: bold;
font-size: 12pt;
line-height: 14pt;
font-family: helvetica;
font-variant: normal;
font-style: normal;
}
|
7. ½ºÅ¸ÀÏ ½ÃÆ® Ŭ·¡½º ÁöÁ¤Çϱâ
|
<style> ű×.Ŭ·¡½º À̸§{½ºÅ¸ÀÏ Á¤ÀÇ} .Ŭ·¡½ºÀ̸§ {½ºÅ¸ÀÏÁ¤ÀÇ} </style> <ÅÂ±× class="Ŭ·¡½ºÀ̸§"> |
|
<HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=euc-kr"> <TITLE>½ºÅ¸ÀÏ ½ÃÆ®ÀÇ Å¬·¡½º Á¤ÀÇÇϱâ</TITLE> <STYLE type="text/css"> H1.mystyle { color : blue; text-align : center; } .yourstyle { color : red; text-decoration : underline; } </STYLE> </HEAD> <BODY> <H1>Ŭ·¡½º¸¦ ÁöÁ¤ÇÏÁö ¾ÊÀº ¹®Àå</H1> <H1 class="mystyle">mystyle Ŭ·¡½º¸¦ ÁöÁ¤ÇÑ ¹®Àå</H1> <h2 class="yourstyle">yourstyle Ŭ·¡½º¸¦ ÁöÁ¤ÇÑ ¹®Àå</H2> <P class="yourstyle">yourstyle Ŭ·¡½º¸¦ ÁöÁ¤ÇÑ ¹®Àå</P> </BODY> </HTML> |
8. Anchor ű׿¡ ½ºÅ¸ÀÏ ½ÃÆ® Àû¿ëÇϱâ(¸µÅ©È¿°ú)
|
<head> <style thpe="text/css"> A:link {color: a3dc57; text-decoration: none} A:visited {color: a3dc57; text-decoration: none} A:active {color: white; text-decoration: none} A:hover {color: ff6600; font-family: ±Ã¼; text-decoration: underline} </style> </HEAD> |
9. ½ºÅ¸ÀÏ ½ÃÆ® ¿¹Á¦
|
<HEAD> <STYLE TYPE = "text/css"> P {textAligh:Center; margin-left:20%; margin-right:20%;} H4 {text-decoration:underline; color:green;} H5 {text-transfor:uppercase; colr:red; border-width:4pt; border-style:outset; background-color:yellow; padding:4pt border-color:red;} BLOCKQUOTE { color:blue; font-style:italic; line-height:1.5; text-indent:10% } </STYLE> </HEAD> <BODY> <H4>¹ØÁñ ±×¾îÁø Heading 4</H4> <BLOCKQUOTE> ÀÌ ¹®´ÜÀº Àο빮ÀÔ´Ï´Ù. Àο빮À» »ç¿ëÇÒ ¶§´Â ÀüüÀûÀ¸·Î µé¿©¾²±â¸¦ ÇÒ ¶§ ù±ÛÀÚ´Â Á»´õ µé¿©¾²´Â °ÍÀÌ Àο빮ÀÌ °Á¶µË´Ï´Ù. ¶ÇÇÑ ÀÌ Àο빮¿¡¼´Â ±ÛÀÚ ±æÀ̰¡ ÀÏ¹Ý Àο빮¿¡¼º¸´Ù Á»´õ ±æ°Ô Ç¥½ÃµË´Ï´Ù. <H5>Å׵θ®°¡ ÀÖ°í ¿µ¹®ÀÌ ´ë¹®ÀڷΠǥ½ÃµÇ´Â heading 5</H5> </BLOCKQUOTE> <P>ÀÌ ¹®´ÜÀº ÅØ½ºÆ®°¡ °¡¿îµ¥·Î Á¤·ÄµÇ¾î ÀÖ½À´Ï´Ù. ¶ÇÇÑ ¿©¹éÀÌ Å©±â ¶§¹®¿¡ °¢ ¶óÀÎÀÌ ¹®¼ÀÇ Á¿쿡¼ ¸Ö¸® ¶³¾îÁ® °¡¿îµ¥·Î Á¤·ÄµË´Ï´Ù. </P> </BODY> </HTML>
|
10. Font
'font-family', 'font-style', 'font-variant' and 'font-weight', 'font-size', 'font'.
|
font-family |
| Value: [[<family-name> | <generic-family>],]* [<family-name> | <generic-family>] |
BODY { font-family: gill, helvetica, sans-serif }
|
|
font-style |
| Value: normal | italic | oblique |
H1, H2, H3 { font-style: italic }
H1 EM { font-style: normal }
|
| font-variant |
| Value: normal | small-caps |
H3 { font-variant: small-caps }
EM { font-style: oblique }
|
| font-weight |
| Value: normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 |
P { font-weight: normal } /* 400 */
H1 { font-weight: 700 } /* bold */
|
| font-size |
| Value: <absolute-size> | <relative-size> | <length> | <percentage> |
P { font-size: 12pt; }
BLOCKQUOTE { font-size: larger }
EM { font-size: 150% }
EM { font-size: 1.5em }
|
11. color
| color |
| Value: <color> |
| EM { color: red } /* natural language */
EM { color: rgb(255,0,0) } /* RGB range 0-255 */ |
12. Text
| 'word-spacing' |
| Value: normal | <length> |
| H1 { word-spacing: 1em } //°¢ ´Ü¾îÀÇ °£°Ý |
| 'letter-spacing' |
| Value: normal | <length> |
| BLOCKQUOTE { letter-spacing: 0.1em } // °¢ ´Ü¾îÀÇ °£°Ý |
13. Box
| 'margin-top', 'margin-right', 'margin-bottom', 'margin-left' |
| Value: <length> | <percentage> | auto |
| H1 { margin-top: 2em }
H1 { margin-right: 12.3% } H1 { margin-bottom: 3px } H1 { margin-left: 2em } |