<!DOCTYPE html>
<html>
<head>
<title>Overlay text over img</title>
<style>
p{
position:absolute;
top: 80px;
left: 80px;
color: white;
}
</style>
</head>
<body>
<img src="../images/finnish.jpeg" alt="Clean">
<p>Clean</p>
</body>
</html>
My question is why people place img and text inside a div in html and then in css they set the position of img into relative and position of the text (in this case is p) into absolute. I tried the code above, and it still works without setting the position of img into relative. May someone explain it for me why people doing that?