ul , li ű׸¦ ÀÌ¿ëÇؼ ¾Æ·¡Ã³·³ ¸ÖƼ ¶óÀÎÀ¸·Î Ç¥½Ã Çغ¸ÀÚ. ul ½ºÅ¸ÀÏ¿¡¼ ÁöÁ¤ÇÑ width¸¦ ³Ñ¾î°¡¸é ´ÙÀ½ ¶óÀο¡¼ Ç¥½ÃÇÑ´Ù. ul width°¡ 240px, li width°¡ 80pxÀÌ´Ù. ÇÑÁÙ¿¡ 3°³¾¿¸¸ Ç¥½Ã ÇÏ¿´´Ù. box-sizing:border-box; /* ¹Ú½º width °è»êÀ» Á¤È®ÇÏ°Ô ÇϱâÀ§ÇØ Ãß°¡ */ <style>
ul { font-size:10pt; width:240px; padding:0px; margin:0px; border:1px solid; float:left; } ul li { list-style-type:none; width:80px; height: 30px; line-height: 30px; text-align:center; display:inline; padding-right:10px; padding-left:10px; margin:0px; box-sizing:border-box; border-right:1px solid green; float: left; } ul li:nth-child(3n) { border-right:0px; } </style> body´Â ´ÙÀ½°ú °°´Ù. <body>
<h2>ul multi line</h2> <ul> <li>January</li> <li>February</li> <li>March</li> <li>April</li> <li>May</li> <li>June</li> <li>July</li> <li>August</li> </ul> </body> ´Ù¿î·Îµå: ul_multiline.html ÆÁ) nth-child¿¡ ´ëÇؼn¹ø° , Ȧ¼ö, ¦¼ö ÀÚ½Ä ¿ä¿¡¸¸ ƯÁ¤ ½ºÅ¸ÀÏÀ» ÁöÁ¤ÇÏ°í ½ÍÀ»¶§ »ç¿ëÇÏ´Â ¼±ÅÃÀÚÀÌ´Ù.´ÙÀ½ÀÇ body°¡ ÀÖ´Ù. <p>January</p>
<p>February</p> <p>March</p> <p>April</p> <p>May</p> <p>June</p> <p>July</p> <p>August</p> ½ºÅ¸ÀÏ¿¡¼ 3n Àû¿ë : 3ÀÇ ¹è¼ö ¿ä¼Ò ¸¶´Ù Àû¿ëµÈ´Ù. p:nth-child(3n) {
color: red; } ½ºÅ¸ÀÏ¿¡¼ 3 Àû¿ë : 3¹ø° ¿ä¼Ò¸¸ Àû¿ëµÈ´Ù. p:nth-child(3) {
color: red; } ½ºÅ¸ÀÏ¿¡¼ odd Àû¿ë : Ȧ¼ö¿¡¸¸ Àû¿ëÇÑ´Ù. ¦¼ö¿¡¸¸ Àû¿ë ÇÒ¶§´Â "even"À» »ç¿ëÇÑ´Ù. p:nth-child(odd) {
color: red; } ½ºÅ¸ÀÏ¿¡¼ (-n+3) Àû¿ë : óÀ½ºÎÅÍ 3¹ø°±îÁö Àû¿ë ÇÒ¶§´Â "-n"À» ¾Õ¿¡ ³ÖÀ¸¸é µÈ´Ù. p:nth-child(-n+3) {
color: red; } ½ºÅ¸ÀÏ¿¡¼ (3n+2)Àû¿ë: ¹Ýº¹Àº 3n, ½ÃÀÛÀº 2¹ø°ºÎÅÍ Àû¿ë ÇÑ´Ù. p:nth-child(3n+2) {
color: red; } ÁÖÀÇ »çÇ×) ÇØ´çÇϴ ű׿¡ ´Ù¸¥ űװ¡ Á¸ÀçÇÒ °æ¿ì Àû¿ëÀÌ Á¤»óÀûÀ¸·Î µÇÁö ¾Ê´Â´Ù. À̶§´Â nth-of-type, nth-last-of-type¸¦ ÀÌ¿ëÇÑ´Ù. ½ºÅ¸ÀÏ¿¡ nth-last-of-type Àû¿ë : ¾Æ·¡´Â ¸¶Áö¸· 3°³¿¡ Àû¿ëÇÏ°í ÀÖ´Ù. nth-last-child´Â Á¤»óÀûÀ¸·Î Àû¿ë µÇÁö ¾Ê°í ¸¶Áö¸· 2°³¸¸ Àû¿ëµÈ´Ù. p:nth-last-of-type(-n+3) {
color: red; } ´Ù¿î·Îµå: nth_last_of_type.html Âü°í) https://webisfree.com/2015-10-10/[css]-nth-child()-¼±ÅÃÀÚ¿¡-´ëÇÑ-css-Àû¿ë¹æ¹ý-Ȧ¼ö-¹×-¦¼ö¹ø°-¿ä¼Ò-¼±Åà http://html5around.com/wordpress/tutorials/css3-nth-child/ http://aboooks.tistory.com/319?category=516604 |