我有這個div
:中心一個div的垂直內容
HTML:
<div draggable="false" id="coffe">Free coffee</div>
CSS:
div {
position: absolute;
overflow: auto;
text-align: left;
font-size: 23px;
color: rgb(26, 66, 108);
font-family: roboto, Helvetica;
font-style: normal;
font-weight: bold;
-webkit-transition: none;
transition: none;
left: 0px;
top: 67.125px;
width: 1029.25px;
height: 234.93749999999997px;
opacity: 1;
background: grey;
}
,我需要垂直居中的內容,這是「免費咖啡」。
我該怎麼做?我嘗試了vertical-align: middle;
但它不起作用。
這是小提琴文件:http://jsfiddle.net/2Mb39/
的[中央單可能重複和多行垂直文本](http://stackoverflow.com/questions/4095165/center-single-and-multi-line-li-text-vertically) – isherwood
或http://stackoverflow.com/questions/4952943/vertically-center -align-text – isherwood
或http://stackoverflow.com/questions/12649287/vertically-centering-inline-content-using-line-height – isherwood