웹표준,웹접근성(html, html5, css, css3, javascript, jQuery, jQueryMobile, snecha, senchaTouch, php, mobileWebApp)

28. only-of-type - 자식 선택자 본문

css3/selector

28. only-of-type - 자식 선택자

jokack01 2013. 10. 1. 11:15

only-of-type - 자식 선택자

: 부모로 부터 지정된 요소를 오직 하나만 갖고 있는 요소의 집합

 

ex) 부모로 부터 p 요소를 하나만 가지고고 있는 요소 선택 ( 예 : p:only-of-type )

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>:only-of-type</title>
<style>
p:only-of-type
{
background:#ffff00;
}
</style>
</head>
<body>
     
    <h1>:only-of-type</h1>
     
    <h3>부모로 부터 지정된 요소를 오직 하나만 갖고 있는 요소의 집합</h3>
    <p>body로 부터 하나인 p </p>
     
    <div>
        <p>div로 부터 첫번째 p </p>
        <p>div로 부터 두번째 p </p>
        <p>div로 부터 세번째 p </p>   
    </div>
    <div>
        <p>div로 부터 하나인 p </p>
    </div>
  
</body>
</html>

'css3 > selector' 카테고리의 다른 글

30. nth-last-child(n) - 자식 선택자  (0) 2013.10.01
29. nth-child(n) - 자식 선택자  (0) 2013.10.01
27. last-of-type - 자식 선택자  (0) 2013.10.01
26. first-of-type - 자식 선택자  (0) 2013.10.01
25.attribute*=value  (0) 2013.10.01