<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>JS Bin</title>
  </head>
  <body>
    <article class="container">
    <div></div>
    <div class="box">I'm box</div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
  </body>
</html>
div{
  width: 50px;
  height: 50px;
  margin-bottom: 20px;
  background: red;
}

.container{
  background: yellow;
  left: 20px;
  top: 20px;
  position: static;
}

.box{
  background: skyblue;
  left: 20px;
  top: 20px;
}

position 은 기본 값으로 static을 가지고 있다. 이 static은 HTML에 정의된 순서대로 자연스럽게 보여진다. article이 body안에 담겨져 있기 때문에 끝 쪽으로 딱 붙어있는 것이다.

container의 위치를 바꾸려면?

.container{
  background: yellow;
  left: 20px;
  top: 20px;
  position: relative;
}

분홍색 칠해진 부분이 떨어진 것 확인 가능하다.

I'm box 를 옮겨보자.

.box{
  background: skyblue;
  left: 20px;
  top: 20px;
  position: relative;
}

원래 있어야 할 자리에서 20px 씩 옮겨진다.

.box{
  background: skyblue;
  left: 20px;
  top: 20px;
  position: absolute;
}

absolute 는 item과 가장 가까이에 있는 박스의 위치에서 옮겨진다. 가장 가까운 것이 article.container 니까 container의 끝 쪽에서 움직인 것이다.

(정확 하게는 부모의 position이 static 이 아닌 것을 찾을 때까지 부모를 찾아 상위로 올라간다.)

또한 div 가 한 칸 씩 올라왔다. 함께 위치해 있던 아이템들의 재배치가 일어난다.

.box{
  background: skyblue;
  left: 20px;
  top: 20px;
  position: fixed;
}

상자 안에서 완전히 벗어나서 window를 기준으로 움직인다. (viewport 에서 지정된다.)