position property (http://www.w3.org/TR/CSS21/visuren.html#positioning-scheme)
-
static
- (기본값) normal flow에 따라서 배치된다. (Visual formatting model : Normal flow)
- top, left. bottom, right 속성이 적용되지 않는다.
-
relative
- static일때의 위치를 기준으로 top, left, bottom, right 속성이 적용된다.
- relative인 box B가 있고, 그 다음에 나오는 sibling은 B의 static 영역을 기준으로 자리를 잡는다.
- relative가 적용되지 않는 block elements : table-row-group, table-header-group, table-footer-group, table-row, table-column-group, table-column, table-cell, table-caption
-
absolute
- top, left, bottom, right 속성이 자신을 포함하는 box의 위치를 기준으로 적용된다.
- 다른 sibling과의 위치에 영향을 주지 않는다.
- margin 값이 있어도 다른 box의 margin과 합쳐지지 않는다. (Box model : Collapse margins)
-
fixed
- absolute와 비슷하지만, 자신을 포함하는 box가 아닌 viewport의 맨위좌측을 기준으로 적용된다.
- 스크롤되지 않고, 항상 같은 위치에 보이게 된다.
- print media type에 적용되는 경우, 모든 페이지에 나타난다.
-
따라서 화면에는 항상 나타나지만, 프린트할때는 한번만 보이게 할경우... screen의 경우 fixed, print의 경우 static으로 다르게 설정해 주어야 한다.
@media screen { h1#first { position: fixed } } @media print { h1#first { position: static } }
** position 속성 예제 포스트 참고하기! - http://mkyoon.com/56>
이 글은 스프링노트에서 작성되었습니다.



