1

I am struggling with aligning the text with the images that sits besides to it. I want to put an image with a text in the ASP.NET Ajax TabContainer (inside the TabPanel specifically) and I want this to works for this case and other cases. I searched a lot but most of the resources talked about special situations based on the height or width of the image. What about if I have more that one image with different dimensions.

So could you please help me in giving me such a way for aligning the text with any image?

My ASP.NET code:

<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>

My CSS that I tried to make it works is:

/* For aligning the image (icon) with the text */
.icon
{
    display: block;
    margin-left: auto;
    margin-right: auto 
}

1 Answer 1

1

Use vertical-align:middle; on your image.
Here is an example with stackoverflow icon http://jsfiddle.net/tDfDP/

Hope this help

2
  • Thanks for your help. I really appreciate it and it works well with me. One more question, can I use this way with any image? Jul 20, 2012 at 20:02
  • With every image you want to align in the middle yes :) Jul 20, 2012 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.