[英]How to align the text with the image that is besides to it?
我正在努力使文本与旁边的图像对齐。 我想将带有文本的图像放在ASP.NET Ajax TabContainer中(特别是在TabPanel内部),并且我希望这种方法适用于这种情况和其他情况。 我进行了很多搜索,但是大多数资源都基于图像的高度或宽度谈论特殊情况。 如果我有一张以上的不同尺寸的图像该怎么办。
那么,能否请您帮我给我这样一种使文本与任何图像对齐的方式吗?
我的ASP.NET代码:
<ajaxToolkit:TabPanel ID="ImagesGallery" runat="server" OnDemandMode="Once" Enabled="true" >
<HeaderTemplate><img src="images/New/image.png" class="icon" alt="" /> Images Gallery</HeaderTemplate>
</ajaxToolkit:TabPanel>
我试图使其起作用的CSS是:
/* For aligning the image (icon) with the text */
.icon
{
display: block;
margin-left: auto;
margin-right: auto
}
使用vertical-align:middle;
在您的图像上。
这是一个带有stackoverflow图标http://jsfiddle.net/tDfDP/的示例
希望这个帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.