728x90
Position attribute[static, relative, absolute, fixed]
position:static
초기값으로 위치를 지정하지 않을 때와 같다.
앞에서 설정된 position을 무시할 때 사용되기도 한다.
top, bottom, left, right 속성값이 적용되지 않는다.
static1
static2
static3
position:relative
위치 계산을 할 때 static의 원래 위치부터 계산한다.
top, bottom, left, right 속성값을 지정할 수 있으며 위치를 같이 설정할 수도 있다.
static1
relative2
relative3
position:absolute
relative와 달리 문서의 원래 위치와 상관없이 위치를 지정할 수 있다.
하지만 가장 가까운 상위 요소를기준으로 (단 static은 제외) 위치가 결정된다.
상위 요소가 없으면 위치는 html을 기준으로 설정된다. 지금 브라우저 좌측 상단에 있을 것이다
static1
absolute2
absolute3
static1, absolute2(top:0px left:100px), absolute3(top:0px left:200px)
relative1
absolute2
absolute3
relative1(top:100px left:100px){ absolute2(top:0px left:100px), absolute3(top:0px left:200px)}
position:fixed
브라우저 화면의 상대 위치 이다.
따라서 화면이 바뀌더라도 고정된 위치를 설정할 수 있다.(상위 요소에 영향을 받지 않음)
IE7,IE8 은 값이 적용되지 않으므로 문서 타입을 규정해 주어야 한다.
static1
absolute2
fixed3
'my_lesson > _CSS3' 카테고리의 다른 글
CSS Float & Clear attribute[none, right, left, both] (0) | 2015.03.23 |
---|---|
CSS2 Z-index attribute[auto, number, initial] (0) | 2015.03.23 |
CSS font attribute (0) | 2015.03.22 |
CSS border-radius 이해하기 (0) | 2014.08.15 |
CSS3 lesson - 둥근 모서리 만들기[border-radius] (0) | 2013.11.24 |
댓글