Pseudo-elements and pseudo-classes
¢¸ ¢º
°ÅÁþ element¿Í class´Â ´õ ´Ù¾çÇÏ°Ô ½ºÅ¸ÀÏÀ» Àû¿ë½ÃÅ°±â À§Çؼ HTML 4.0¿¡ Á¸ÀçÇÏÁö ¾Ê´Â element¸¦ ¸¸µé¾î ³½ °ÍÀ» ¸»ÇÑ´Ù.
- Pseudo-elements : ElementÀÇ ÀϺκÐÀ» ÇϳªÀÇ element·Î ¸¸µç´Ù. ÇϳªÀÇ selector¿¡ ÇϳªÀÇ pseudo-element¸¸ÀÌ »ç¿ëµÉ ¼ö ÀÖ´Ù. ¿¹) ¹®´ÜÀÇ Ã¹ ÁÙÀ̳ª ù ±ÛÀÚ.
- Pseuo-classes : ±×·ìÀ¸·Î ¹ÀÏ ¼ö ÀÖ´Â elementµéÀ» Çϳª·Î ¸¸µç´Ù. ¿¹) »õ ¸µÅ©¿Í °¡º» ÀûÀÌ ÀÖ´Â ¸µÅ©, Ŭ¸¯ÇÏ´Â ¼ø°£ÀÇ ¸µÅ©.
First-line pseudo-element
¹®´ÜÀÇ Ã¹ ÁÙ¿¡¸¸ ½ºÅ¸ÀÏÀ» ÁÙ ¶§ »ç¿ëÇÑ´Ù. Ư¼º»ó Block-level elements¿¡¸¸ Àû¿ëµÈ´Ù.
<HTML>
<HEAD>
<STYLE type = "text/css">
P:first-line { color : green }
</STYLE>
</HEAD>
<BODY>
<P>
ÀÌ ¹®´ÜÀº ±æÀÌ°¡ ±æ±â ¶§¹®¿¡ ¿©·¯ ÁÙ¿¡ °ÉÃÄ ³ª¿Ã °ÍÀÔ´Ï´Ù.
ù¹ø° ÁÙÀº ±ÛÀÚ »öÀÌ ³ì»öÀ¸·Î ³ª¿Â´Ù´Â °ÍÀε¥,
first-line pseudo-element´Â ¾ÆÁ÷ Á¦´ë·Î ±¸ÇöÀÌ ¾È µÇ´Â±º¿ä.
´Ù ±î¸ÄÁö¿ä?</P>
</BODY>
</HTML>ÀÌ·¸°Ô ³ª¿Í¿ä
¡Ø ¾ÆÁ÷ À̷дë·Î ±¸ÇöµÇÁö ¾Ê´Â´Ù. Font properties, color properties, background properties, 'word-spacing', 'letter-spacing', 'text-decoration', 'vertical-align', 'text-transform', 'line-height', 'clear'ÇÏ°í¸¸ ÇÔ²² ¾µ ¼ö ÀÖ´Ù.
First-letter pseudo-element
ù ±ÛÀÚ¸¸ Å©°Ô Çϰųª »öÀ» Áְųª ÇÒ ¶§ »ç¿ëÇÑ´Ù.
<HTML>
<HEAD>
<TITLE>Title</TITLE>
<STYLE type="text/css">
P { font-size: 12pt; line-height: 12pt }
P:first-letter { font-size: 200%; font-style: italic; font-weight: bold; float: left }
SPAN { text-transform: uppercase }
</STYLE>
</HEAD>
<BODY>
<P><SPAN>The first</SPAN> few words of an article in The Economist.</P>
</BODY>
</HTML> ÀÌ·¸°Ô ³ª¿Í¿ä
¡Ø ¿ª½Ã ¾ÆÁ÷ ±¸ÇöµÇÁö ¾Ê´Â´Ù. : Font properties, color properties, background properties, 'text-decoration', 'vertical-align' ('float' °ªÀÌ 'none'ÀÏ ¶§¸¸), 'text-transform', 'line-height', margin properties, padding properties, border properties, 'float', 'clear'ÇÏ°í¸¸ ÇÔ²² ¾µ ¼ö ÀÖ´Ù.
First-line°ú first-letter pseudo-element´Â ÇÔ²² ¾µ ¼öµµ Àִٴµ¥... ´ÙÀ½ ¹öÁ¯ÀÇ ºê¶ó¿ìÀú¿¡¼ ±â´ëÇØ º¸ÀÚ.
Anchor pseudo-classes : :link, :visited, :active
¸µÅ©ÀÇ »öÀ̳ª ¹ØÁÙ µîÀ» ¹Ù²Ü ¶§ »ç¿ëÇÑ´Ù. :link´Â ÇÑ ¹øµµ Ŭ¸¯ÇÏÁö ¾ÊÀº ¸µÅ©, :visited´Â °¡º» ÀûÀÌ ÀÖ´Â ¸µÅ©, :active´Â Ŭ¸¯ÇÏ´Â ¼ø°£ÀÇ ¸µÅ©¸¦ ¸»ÇÑ´Ù.
<HTML>
<HEAD>
<TITLE>Title</TITLE>
<STYLE type="text/css">
A:link { color: red } /* :link¶ó°í¸¸ ½áµµ µÈ´Ù. */
A:active { color: lime } /* :active¶ó°í¸¸ ½áµµ µÈ´Ù. */
A:visited { color: blue } /* :visited¶ó°í¸¸ ½áµµ µÈ´Ù. */
A:link, A:active, A:visited { text-decoration : none } /* ¸µÅ©ÀÇ ¹ØÁÙÀ» ¾ø¾Ø´Ù. */
</STYLE>
</HEAD>
<BODY>
<A href = "http://www.chosun.com">Á¶¼±ÀϺ¸</A>
</BODY>
</HTML> ÀÌ·¸°Ô ³ª¿Í¿ä
A.external:link(class=externalÀÎ AÀÇ ¸µÅ©)¿Í °°ÀÌ Å¬·¡½º¿Í °°ÀÌ ¾µ ¼öµµ ÀÖ°í, a.link³ª a#link¿Í °°ÀÌ link, active, visited¸¦ Ŭ·¡½º³ª id·Î »ç¿ëÇÒ ¼öµµ ÀÖ´Ù.
¢¸ ¢º