asp:panel alignment problem

G

Gary Coutts

Hi,

I am trying to center an panel using the following:

<asp:panel id="pnltest" HorizontalAlign="Center" BackColor="white"
Width="800" Runat="server">
<asp:Button id=btnTest Runat="server" Text="press"></asp:Button>
</asp:panel>

When view in a browser the following happens

mozilla firefox V1.0.7 works IE Version 6 doesn't it leaves the panel Left
Aligned


Looking at the sources, they are different:


Mozilla use <table> to render the output

<table id="pnltest" align="Center" cellpadding="0" cellspacing="0"
border="0" bgcolor="White" width="800"><tr><td align="Center">

<input type="submit" name="btnTest" value="press" id="btnTest" />

</td></tr></table> IE uses <div> to render the output<div id="pnltest"
align="Center" style="background-color:White;width:800px;"> <input
type="submit" name="btnTest" value="press" id="btnTest" /></div>Does anyone
know what I am doing wrong.Cheersgwc
 
P

papaja

You are not doing wrong anything. It is up to Microsoft. In asp.net 2.0
both (IE and Firefox) renders panel as div. For IE you can center this
panel via css.
Try this:

* html body #pnltest {
margin-left: auto;
margin-right: auto;
}

This shoul work, if it does not, please provide more html source code.

Milan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top