开发者

How can I vertically center side-by-side anchor and anchor-image tags?

开发者 https://www.devze.com 2023-02-24 11:46 出处:网络
I am having trouble开发者_StackOverflow中文版 centering these two elements. I\'m not sure what my problem is. Hopefully someone can help me out.

I am having trouble开发者_StackOverflow中文版 centering these two elements. I'm not sure what my problem is. Hopefully someone can help me out. First here is an screenshot of what is going on:

How can I vertically center side-by-side anchor and anchor-image tags?

So how do I get these elements vertically centered?

Here is my HTML and CSS:

<div class="vcenter">
<p>
<a href="http://www.google.com">JimDaniel</a>
<a href="http://www.cnn.com"><img src="icon.png"/></a>
</p>
</div>

.vcenter
{
    padding:10px;
    background-color:darkBlue;
    min-height: 25px;   
    display: table-cell;   
    vertical-align: middle;
}

Thanks for the help!


Like this?

http://jsbin.com/opifu5

.vcenter img {
    vertical-align: top
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号