1
我正努力将文字与除此之外的图像对齐。我想在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
}
感谢您的帮助。我很欣赏它,它适合我。还有一个问题,我可以用这种方式与任何图像? – 2012-07-20 20:02:33
与你想要在中间对齐的每个图像是:) – 2012-07-20 20:03:48