<html>
<head>
<style>
body{
margin: 0px;
}
.outer{
width: 500px;
height: 300px;
position: relative;
}
.innerbg{
position: absolute;
background-image: url('https://images.pexels.com/photos/1762851/pexels-photo-1762851.jpeg?cs=srgb&dl=pexels-ann-h-1762851.jpg&fm=jpg');
background-size: cover;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
}
</style>
</head>
<body>
<div class="outer">
<div class="innerbg">
<p>Some content</p>
</div>
</div>
</body>
</html>
You can notice, there is space above the p tag, however, when the position absolute is removed by from the class innerbg, the p tag has no more top space with the view port, why is that?