I cannot work out what rules the layout is following in the following example and wonder if anyone can help.
The exmaple I will use to explain the issue is: If there are just two elements - paragraphs - within a body element and the first paragraph element is absolutely positioned and the second is not, the presence of the second paragaph element causes the first to be layed-out lower than it would be if it was the only element. Why is this?
Also, by adding a border to the body element or by making its padding even just 1px, the position of the absolutely positioned element is no longer affected by the presence of the second paragraph.
The code I am using to demonstate this is:
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<style type="text/css">
body {
margin: 0px;
padding: 0px;
}
p#a {
border: 1px solid black;
position: absolute;
margin: 0px;
}
</style>
</head>
<body>
<p id="a">Some text in absolutely positinoed paragraph</p>
<p>Some text in normal paragraph</p>
</body>
</html>