본문 바로가기

카테고리 없음

CSS 18.Position (




static, fixed, relative, absolute 를 이용하여 엘리먼트를 화면에 배치하는 것을 조절



p.pos_fixed {
    position: fixed;
    top: 30px;
    right: 5px;
}



h2.pos_top {
    position: relative;
    top: -50px;
}



h2 {
    position: absolute;
    left: 100px;
    top: 150px;
}



img {
    position: absolute;
    left: 0px;
    top: 0px;
    z-index: -1;
}




All CSS Positioning Properties

PropertyDescriptionValues
bottomSets the bottom margin edge for a positioned boxauto
length
%
inherit
clipClips an absolutely positioned elementshape
auto
inherit
cursorSpecifies the type of cursor to be displayedurl
auto
crosshair
default
pointer
move
e-resize
ne-resize
nw-resize
n-resize
se-resize
sw-resize
s-resize
w-resize
text
wait
help
leftSets the left margin edge for a positioned boxauto
length
%
inherit
overflow
Specifies what happens if content overflows an element's boxauto
hidden
scroll
visible
inherit
positionSpecifies the type of positioning for an elementabsolute
fixed
relative
static
inherit
rightSets the right margin edge for a positioned boxauto
length
%
inherit
topSets the top margin edge for a positioned boxauto
length
%
inherit
z-indexSets the stack order of an elementnumber
auto
inherit