By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,982 Members | 1,955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,982 IT Pros & Developers. It's quick & easy.

How to Center Align a Panel.

P: n/a
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></centerthen 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.

Oct 9 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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>
--
Milosz Skalecki
MCP, MCAD
"Dinesh" wrote:
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></centerthen 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.

Oct 9 '06 #2

P: n/a
Place the centered div in another div that is set to center.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
"Dinesh" <de****************@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
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></centerthen 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.

Oct 9 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.