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

chapter19 : position 본문

WEB.CSS

chapter19 : position

GAWON 2023. 5. 18. 10:21
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
	/*
		relative
		1. 기존 요소를 참고해서 알아서 배치
		2. 기존 요소를 기준으로 top, bottom, left, right 값을 사용
	*/
	*{
		padding: 0;
		margin: 0;
	}
	div{
		position: relative;
		width: 100px;
		height: 100px;
		border: 1px solid black;
		top: 100px;
		left:100px;
	}
	#red{
		background-color: red;
	}
	#orange{
		background-color: orange;
	}
	#yellow{
		background-color: yellow;
	}
	#green{
		background-color: green;
	}
</style>
</head>
<body>
	<div id="red">
		<div id="orange">
			<div id="yellow">
				<div id="green"></div>
			</div>
		</div>
	</div>
</body>
</html>

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

chapter21 : position  (0) 2023.05.18
chapter20 : position  (0) 2023.05.18
chapter18 : overflow  (0) 2023.05.18
chapter17 : clear  (0) 2023.05.18
chapter16 : float  (0) 2023.05.18