0
我正在尝试对齐div
中的文本。我在这里阅读了SoF的4个主题,他们都推荐使用vertical-align
属性。在我的情况下,它不起作用。垂直对齐父div元素内的文本元素?
.free {
display: inline-block;
-webkit-border-radius: 4;
-moz-border-radius: 4;
border-radius: 4px;
font-family: 'Open Sans', sans-serif;
color: #ff0000;
background: #ffffff;
border: dashed #ff0000 2px;
width: 105px;
height: 46px;
font-size: 1.07rem;
font-weight: bold;
text-align: center;
text-decoration: none;
text-transform: uppercase;
margin-bottom: 0;
}
.free p {
vertical-align: middle;
}
<div class="free">
<p>Text</p>
</div>
感谢您的帮助! – plywoods
欢迎:) –