Your style needs to be in your head. And put your PHP code inside the div and put the div inside the body.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Yellow box experiment</title>
<style>
.yellow-box {
position:absolute; top:100px; left:500px; width:300px;
height:300px;background:yellow
}
</style>
</head>
<body>
<div class="yellow-box">
<?php
for ($i=1; $i <= 10; $i++) {
echo $i . "<br>";
}
?>
</div>
</body>
</html>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…