2011-11-01 4 views

답변

2

요소에 오는되지 않은 table-cellvertical-align: middle을했습니다 http://jsfiddle.net/4Ly4B/을 확인 min-widthmin-height를 무시하십시오 테이블 셀에 작동하지 않습니다. 대신 heightwidth을 사용해야합니다.
position:absolute을 사용하여 요소를 배치하려면 요소를 컨테이너에 넣고이 컨테이너에 position:absolute을 할당합니다. http://jsfiddle.net/4Ly4B/3/

+0

하지만 '최소 높이'가 필요합니다. –

+0

'position : relative;'를 컨테이너에 지정 하시겠습니까? –

0

수직 정렬 :

이 바이올린을 참조 중간; 이 basicall 귀하의 예를 들어 위치를 table-cell.in 위해 사용되는은 절대 u는이

.message{ 
background-color: gray; 
position: absolute; 
min-width: 200px; 
display: table-cell; 
padding:60px 0px 60px 0px; 
text-align: center; 

}

0

속성 수직 정렬이 분 높이 작동하지 않습니다 할 수있는이 방법 . 최소 높이을 제거하고 대신 패딩을 추가하십시오.

.message{ 
    background-color: gray; 
    position: absolute; 
    padding-top: 40px; 
    padding-bottom: 40px; 
    min-width: 200px; 
    display: table-cell; 
    vertical-align: middle; 
    text-align: center; 
}