我有這樣的代碼:如何對齊文本<a>元素垂直,即顯示爲塊
a {
display: block;
width: 231px;
height: 52px;
background-color: #ffffff;
color: #0275d8;
border: 1px solid #0275d8;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
text-align: center;
margin-left: auto;
margin-right: auto;
padding-top: 15px;
padding-bottom: 15px;
font: 16px 'Lato', sans-serif;
}
<a href="#">some text</a>
</br>
<a href="#">some text that is bigger than in the first link</a>
有什麼辦法,我可以垂直對齊文本?恕我直言,這裏使用填充不是一個好主意。任何幫助將不勝感激。謝謝。
非常感謝,它的工作原理。我試過這個解決方案,但沒有'justify-content:center;',所以我認爲這是一個錯誤的方法。 –