어떤 요소이건 position: absolute 또는 fixed가 적용되면 인라인 블록으로 변함.
:before
:after
는 기본적으로 인라인요소
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>display 속성의 이해도</title>
<link rel="stylesheet" href="./assets/css/style.css">
</head>
<body>
<!-- 인라인 요소, 블럭 요소, 인라인 블럭 요소의 복습
<span>Inline Elements...etcetc...</span>
<span>Inline Elements...etcetc...</span>
<span>Inline Elements...etcetc...</span>
<div>Block Elements1</div>
<div>Block Elements2</div>
<img src="./assets/image/picture-01.jpg">
<img src="./assets/image/picture-01.jpg">
<h1>Block Elements</h1> -->
<!-- position의 복습 -->
<!-- <div>Block Elements</div> -->
<!-- before과 after 는 기본적으로 인라인 요소 -->
<h1>Headline Text</h1>
<script src="./assets/js/script.js"></script>
</body>
</html>
CSS
/* span{
border: 1px solid black;
width: 400px;
height: 200ox;
margin: 20px;
}
div{
border: 1px solid red;
margin: 20px;
width: 300px;
height: 50px;
}
img{
margin: 20px;
width: 300px;
height: 300px;
}
h1{
border: 1px solid blue;
display: inline-block;
} */
/*
어떤 요소이건 position: absolute 또는 fixed가 적용되면 인라인블록으로 변함.
*/
div{
border: 1px solid black;
position: absolute;
/* display: block; */
/* display: inline-block; */
width: 400px;
height: 100px;
margin: 50px;
}
/* before after는 기본적으로 인라인요소 */
h1{
border: 1px solid black;
}
h1:before{
content: 'new';
color: red;
border: 1px solid green;
width: 100px;
height: 100px;
margin: 20px;
position: absolute;
}
h1:after{
content: 'hot';
color: blue;
}