我想讓兩個文本標記位於文本區域字段旁邊,並在該文本區域字段的中心垂直對齊。無法在div中垂直居中文本
我試着做
How to Vertically Align Elements in HTML
和
http://www.jakpsatweb.cz/css/css-vertical-center-solution.html
,但無濟於事。
我會後從兩個嘗試代碼 -
嘗試1 -
HTML-
<div class="optionGroup">
<div class="response">
<div class="outer">
<div class="middle">
<div class="inner">
<textarea class="correctResponse"></textarea>
<text class="closeButton centerVertically">✖</text>
<text class="addButton centerVertically">+</text>
</div>
</div>
</div>
CSS-
.outer{
display:table;
position:static;
}
.middle{
display:table-cell;
vertical-align:middle;
width:100%;
}
嘗試2-
H TML-
<textarea class="correctResponse"></textarea>
<text class="closeButton centerVertically">✖</text>
<text class="addButton centerVertically">+</text>
CSS-
.centerVertically{
line-height:100%;
vertical-align:middle;
}
我要去哪裏錯了?我如何得到它,以便兩個文本標籤來到textarea旁邊,並從文本區域的頂部垂直向下一半?
謝謝。
啊COOL-感謝!等待接受 – praks5432