Front/HTML

HTML Step15

NOOWGNAJ 2022. 7. 11. 21:22
반응형
HTML 3일차 1 HTML4.0
X
<html lang="ko">
	<head>
		<meta charset="UTF-8">
		<title>HTML 3일차 1 HTML4.0</title>
		<style>
			body {
				margin: 0;
				padding: 0;
			}
			div {
				width: 100px;
				height: 100px;
				
			}
			.a{
				background-color: orange;
				position: static;
				margin-left: 100%;
			}
			.b{
				background-color: green;			
				position: relative;
				left : 100%;
				margin-left : -100px;
			}
			.c{
				background-color: gray;			
			}
			.d{
				background-color: black;
				position: absolute;
				right: 0px;	
			}
/*
position

오브젝트의 성격을 변화시킬때 사용하는 속성
static : 고정
relative : 중간형태에서 margin, top left right bottom 사용가능
absolute : 자유분방 

*/
			.popup{
				width: 600px;
				height: 600px;
				background-color: yellowgreen;
				display: block;
				position: relative;

			}
			.close{
				width : 50px;
				height: 50px;
				background-color: black;
				position: absolute;
				left : 100%;
				color : white;
				font-size : 25px;
				font-weight : bold;
				text-align: center;
				line-height: 50px;
			}
/*

자식이 absilute일 경우 부모는 무조건 relative로 세팅해야한다.

*/
		</style>
	</head>
	<body>
		
		<div class="a"></div>
		<div class="b"></div>
		<div class="c"></div>
		<div class="d"></div>





		<span class="popup" id="popup">
			<div class="close" onclick="abc()">
				X
			</div>
		</span>
		
	</body>
	<script>
	function abc() {
		
		document.getElementById('popup').style.display='none';
	}
	
	</script>
</html>
반응형