Rumah > Soal Jawab > teks badan
.unsolve { position: absolute; right: 10px; top:50%; transform: translate(0,-50%); z-index: 1; font-size: 13px; background-color: red; border-radius: 50%; color:#fff; width: 15px; height: 15px; padding: 5px; text-align: center; }
<div class="unsolve">12</div>
這樣設定的時候,數字都會中間偏下,沒辦法完全中間。請問該怎麼讓他完全水平垂直置中?
大家讲道理2017-02-24 14:53:18
.unsolve { position: absolute; right: 10px; top:0; bottom: 0; margin:auto; z-index: 1; font-size: 13px; background-color: red; border-radius: 50%; color:#fff; width: 15px; height: 15px; line-height: 15px; padding:5px; text-align: center; }