James Ronaldo James Ronaldo - 5 months ago 23
CSS Question

Can not center image using asp.net and CSS (C#)

I am using the below code to center the image on my page. However the image remains stuck on the lefter side of the page.

I used the same technique on a login form, and it works.

<asp:Image CssStyle="alignCenter" ID="Image1" runat="server" ImageUrl="~/resources/logo.gif" />


.loginbox
{
margin: 0px auto 0px auto;
}

.alignCenter
{
margin: 0 auto;
}

Answer
<asp:Image CssClass="alignCenter" ID="Image1" runat="server" ImageUrl="~/resources/logo.gif" />

"CssClass" is correct attribute name.

Comments