웹표준,웹접근성(html, html5, css, css3, javascript, jQuery, jQueryMobile, snecha, senchaTouch, php, mobileWebApp)
32. nth-last-of-type(n) - 자식 선택자 본문
nth-last-of-type(n) - 자식 선택자
: 부모로 부터 지정된 요소와 지정된 값이 일치하는 자식 요소를 뒤에서 부터 찾는다.
ex) 부모로 부터 마지막 2번째 p요소들을 찾는다. ( 예 : p:nth-last-of-type(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
29
30 |
<!DOCTYPE HTML> < html > < head > < meta charset = "utf-8" > < title >:nth-last-of-type(n)</ title > < style > p:nth-last-of-type(2) { background:#ffff00; } </ style > </ head > < body > < h1 >:nth-last-of-type(n)</ h1 > < h3 >부모로 부터 지정된 요소와 지정된 값이 일치하는 자식 요소를 뒤에서 부터 찾는다.</ h3 > < p >body로 첫번째 자식요소인 p </ p > < p >body로 두번째 자식요소 이면서 뒤에서 부터 두번째 자식인 p </ p > < 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' 카테고리의 다른 글
34. root - 최상위 엘리먼트 선택자 (0) | 2013.10.01 |
---|---|
33. last-child - 자식 선택자 (0) | 2013.10.01 |
31. nth-of-type(n) - 자식 선택자 (0) | 2013.10.01 |
30. nth-last-child(n) - 자식 선택자 (0) | 2013.10.01 |
29. nth-child(n) - 자식 선택자 (0) | 2013.10.01 |