How to Center Align a Panel.

D

Dinesh

Dear All,
Can u tell me how to center align a div (Panel) in Asp.Net 2.0.
If we use align="center" then it will be converted to text-align:center
which will align all the content of the div's object but not the div
itself. Also this is only valid in IE in case of mozilla even that
don't work. If we use <center></center> then it will work in both the
browsers but its a depreciated tag. So could any 1 tell me the best way
of that.

thanks in advance.
Deepak.
 
G

Guest

Hi Dinesh,

It's strictly HTML/CSS, not asp.net 2.0. Panel must be placed inside a
container that has align set to center, i.e.

<table width="100%">
<tr>
<td align="center">
<asp:panel runat="server" ID="MyCenteredPanel"/>
</td>
</tr>
</table>

or

<div style="text-align:center; width: 100%">
<asp:panel runat="server" ID="MyCenteredPanel"/>
</div>
 
C

Cowboy \(Gregory A. Beamer\)

Place the centered div in another div that is set to center.
 

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,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top