[英]CSS: Align text to an element with display inline-block
我旁边有一个简短的文本,我必须在其中添加一个链接。 该链接不应以文字显示,而应以图像显示。 到目前为止,没有问题,但是要使用图像,我必须设置display:inline-block
才能设置标签的宽度/高度。 一旦我做完,右边右边的下一个就会在包含div的地方向下跳。 我绝对无法将其向上移动。 代码是:
<div>
<p id="pid">Some prefixing text that shouldn't be at the bottom of the div but rather in the middle <a href="#" target="_blank">This is some link</a></p>
</div>
#pid {
border: 1px solid blue;
float: right;
}
#pid a {
display: inline-block;
width: 50px;
height: 53px;
}
那么如何向上移动前缀文本? 非常感谢!
是否在<a>
标记上的vertical-align: middle
<a>
?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.