Notice
Recent Posts
Recent Comments
Link
«   2024/10   »
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 31
Tags
more
Archives
Today
Total
관리 메뉴

WON.dev

chapter28 : pseudo_class 본문

WEB.CSS

chapter28 : pseudo_class

GAWON 2023. 5. 18. 10:32
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
	/*
		1. E:nth-child(n) 		: n번째 요소
		2. E:nth-child(odd)		: 홀수번째 요소
		3. E:nth-child(even) 	: 짝수번째 요소
		4. E:nth-child(an+b)	: b번째부터 a단위 요소
		5. E:nth-of-type(n)		: E 타입 요소 중에서 n번째 요소
	*/
	body p:nth-child(2) {
		color: red;
	}
	body p:nth-of-type(2) {
		color: blue;
	}
	body p:nth-child(2n+0) {
		font-weight: bold;
	}

</style>
</head>
<body>
	<div>여기가 div</div>
	<p>첫 번째 P</p>
	<p>두 번째 P</p>
	<p>세 번째 P</p>
	<p>네 번째 P</p>
</body>
</html>

'WEB.CSS' 카테고리의 다른 글

chapter30 : table  (0) 2023.05.18
chapter29 : pseudo_class  (0) 2023.05.18
chapter27 : menu  (0) 2023.05.18
chapter26 : menu  (0) 2023.05.18
chapter25 : menu  (0) 2023.05.18