when absolute positioning does not have a parent element with positioning attributes, is it relative to the browser window or body or html?
the left outer margin of body and html is tested, and it is found that the position of the div block does not affect it. So it"s relative to the browser window?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
html{
margin-left: 100px;
background-color: yellow;
}
body{
margin-left: 10px;
background-color: cornflowerblue;
height: 500px;
}
div{
position: absolute;
left: 50px;
top: 50px;
background-color: deeppink;
height: 300px;
width: 300px;
}
</style>
</head>
<body>
htmlbody
<div>
--
</div>
</body>
</html>