일반적으로이 코드는 작동하지만 어떤 이유로 인해 부모 요소의 가운데에 세로로 가운데 맞춤이 아닙니다. 이것이 배경 이미지 때문일 수 있습니까?변형 된 수직 센터링이 예상대로 작동하지 않습니다.
http://jsfiddle.net/tmyie/BcmNw/
<div class="background-image">
<div class="omg-title">This is the title</div>
</div>
CSS :
.background-image {
background-image: url('');
height: 600px;
background-size: contain;
position: relative;
background-position: center;
background-repeat: no-repeat;
margin: 0 auto;
text-align: center;
}
.omg-title {
padding: 15px;
-webkit-transform: translate(-50%, -50%);
position: absolute;
}
그것 때문에'위치의 두 번째 솔루션의 예를 적용 absolute' ..을 당신이 필요한 이유? – Era
방금 제거 했으니 아무런 변화가 없었습니다. –
절대 위치를 제거한 후 Mozilla와 완벽 함을 확인했습니다. 당신의 브라우저는 무엇입니까? – Era