웹표준,웹접근성(html, html5, css, css3, javascript, jQuery, jQueryMobile, snecha, senchaTouch, php, mobileWebApp)
30. nth-last-child(n) - 자식 선택자 본문
nth-last-child(n) - 자식 선택자
: 부모 마지막 자식(뒤에서 부터)에서 부터 지정된 값만큼의 자식 요소를 찾는다.
ex) 부모로 부터 뒤에서 2번째 자식인 요소 선택 ( 예 : p:nth-last-child(2) )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 |
<!DOCTYPE HTML> < html > < head > < meta charset = "utf-8" > < title >:nth-last-child(n)</ title > < style > p:nth-last-child(2) { background:#ffff00; } </ style > </ head > < body > < h1 >:nth-last-child(n)</ h1 > < h3 >부모 마지막 자식(뒤에서 부터)에서 부터 지정된 값만큼의 자식 요소를 찾는다.</ h3 > < p >body로 세번째 자식 이면서 마지막 두번째 요소인 p </ p > < div > < p >div로 부터 첫번째 자식인 p </ p > < p >div로 부터 두번째 자식인 p </ p > < p >div로 부터 세번째 자식인 p </ p > < p >div로 부터 네번째 자식인 p </ p > </ div > </ body > </ html > |
'css3 > selector' 카테고리의 다른 글
32. nth-last-of-type(n) - 자식 선택자 (0) | 2013.10.01 |
---|---|
31. nth-of-type(n) - 자식 선택자 (0) | 2013.10.01 |
29. nth-child(n) - 자식 선택자 (0) | 2013.10.01 |
28. only-of-type - 자식 선택자 (0) | 2013.10.01 |
27. last-of-type - 자식 선택자 (0) | 2013.10.01 |