This article I was writing with help of this article.

As copy pasted from above mentioned article:

"When you specify position:absolute, the element is removed from the document and placed exactly where you tell it to go."

Lets check first example:

<!DOCTYPE html>
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="/index.css"></link>
	</head>
	<body>

        <div id="main">
            <div id="relativePos">
                <legend>Relative position</legend>
                Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit.
                <div id="absolutePos">
                    <legend>Absolute position</legend>
                    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit. Nam mattis, arcu ut bibendum commodo, magna nisi tincidunt tortor, quis accumsan augue ipsum id lorem.
                </div>
            </div>

        </div>

	</body>
</html>

CSS:

pre {
	background: blue;
	width: 500px;
}

#relativePos {
	position: relative;
	top: 200px;
    background: red;
}

#absolutePos {
	position: absolute;
	top: 0px;
    background: green;
}

#anotherPos {
	position: relative;
	top: 20px;
}

In this CSS notice that relativePos top is 200px, and absolutePos is 0px, try to play a little with relativePos and you will see that also red part is moving togehter with relative.

How it looks like you can see here - here I added one width just to display red and green areas.

As you can see red and green color are overlapped because div with absolute position (red) is inside the div with relative position (green).

Now lets check example where red (absolute div) is outside of green div. CSS will remain the same, HTML now looks like:

<!DOCTYPE html>
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="/index.css"></link>
	</head>
	<body>

        <div id="main">
            <div id="relativePos">
                <legend>Relative position</legend>
                Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit.
            </div>
			
			<div id="absolutePos">
				<legend>Absolute position</legend>
				Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit. Nam mattis, arcu ut bibendum commodo, magna nisi tincidunt tortor, quis accumsan augue ipsum id lorem.
			</div>			

        </div>

	</body>
</html>

Example you can see here.

Notice in HTML code that absolute position (green) in HTML is under relative (red), but if you check how it looks like in web page you will see that green is above red, that is because in css is defined as an absolute position, and it is positioned in exactly where you tell it to go, it is "removed from document"

On the end lets switch red and green div, just to see what will happen.

HTML now looks like:

<!DOCTYPE html>
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="/index.css"></link>
	</head>
	<body>

        <div id="main">
		
			<div id="absolutePos">
				<legend>Absolute position</legend>
				Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit. Nam mattis, arcu ut bibendum commodo, magna nisi tincidunt tortor, quis accumsan augue ipsum id lorem.
			</div>		
		
            <div id="relativePos">
                <legend>Relative position</legend>
                Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer pretium dui sit amet felis. Integer sit amet diam. Phasellus ultrices viverra velit.
            </div>

        </div>

	</body>
</html>

Example you can see here. As you can see position didn't change, compared with previous example.