Does anyone know a way to center the info. on a webpage? I want my
web site to work like MySpace.com where the page content remains
centered when I resize the browser window. For the life of me I can't
figure out how to do it. I am desperate to figure it out today!
Please help!
FYI: I am referencing one master page file in all of my web pages.
The content of my pages are stored in one or more panel controls.
- Melissa
(Using Asp.net 2.0, Visual Basic, Windows XP Pro SP2)
Open up Internet Explorer, click the View menu, select the Source menu item.
:-)
Honestly, I imagine they're applying CSS styles to DIV and TABLE tags, but
I'm not absolutely sure on that; I usually farm out that UI work to other
people and concentrate on the data/business layer.

Signature
~~~~~~~~~~~~~~~~~~~~~~~~~~
Ben Rush
Microsoft .NET Consultant
http://www.ben-rush.net/blog
http://www.sideshowsystems.com
> Does anyone know a way to center the info. on a webpage? I want my
> web site to work like MySpace.com where the page content remains
[quoted text clipped - 7 lines]
> - Melissa
> (Using Asp.net 2.0, Visual Basic, Windows XP Pro SP2)
Mel - 21 Jun 2007 16:39 GMT
> Open up Internet Explorer, click the View menu, select the Source menu item.
>
[quoted text clipped - 22 lines]
>
> - Show quoted text -
Yep the source is what I have been sifting through. It doesn't make
much sense to me though. It's sort of like reading greek. I have
tried a few things but I thought someone could point me in the right
direction.
> I am desperate to figure it out today!
<asp:Panel ID="MyPanel" runat="server" HorizontalAlign="center">
</asp:Panel>
or
<div style="margin-left:auto;margin-right:auto;">
</div>

Signature
http://www.markrae.net
Mel - 21 Jun 2007 16:55 GMT
> > I am desperate to figure it out today!
>
[quoted text clipped - 9 lines]
>
> --http://www.markrae.net
Thank you for the quick response. I tried the
HorizontalAlign="center" and it didn't work when I looked at it with
Internet Explorer. Am I missing something else?
This is the code for my top panel (on the master page). Basically the
top panel is aligned at the top of the window and it just has our logo
in the center and labels on each side.
<asp:Panel ID="pnlTop" runat="server" HorizontalAlign="center"
BackColor="Black" Height="94px" Style="z-index: 100;
left: 0px; position: absolute; top: 0px;" Width="850px">
<asp:Label ID="lblWelcome" runat="server"
BackColor="Transparent" BorderStyle="None"
Font-Names="Verdana" Font-Size="Medium"
ForeColor="#E0E0E0" Height="14px"
Style="z-index: 100; left: 10px; position: absolute;
top: 11px" Text="Welcome:"></asp:Label>
<asp:Label ID="lblRepFirm" runat="server" Style="z-index:
106; left: 96px; position: absolute;
top: 39px; text-align: left;" Text="Label"
Width="219px" BackColor="Black" Font-Names="Verdana" Font-Size="Small"
ForeColor="White"></asp:Label>
<asp:Label ID="lblRepCity" runat="server"
BackColor="Black" Font-Names="Verdana"
Font-Size="Small" ForeColor="White" Style="z-index:
102; left: 96px; position: absolute;
top: 62px; text-align: left;" Text="Label"
Width="119px"></asp:Label>
<asp:Label ID="lblRepSt" runat="server" BackColor="Black"
Font-Names="Verdana"
Font-Size="Small" ForeColor="White" Style="z-index:
103; left: 224px; position: absolute;
top: 62px; text-align: left;" Text="Label"></
asp:Label>
<asp:Image ID="imgLogo" runat="server" Height="73px"
ImageUrl="~/Images/logo_unaclad.gif"
Style="z-index: 104; left: 318px; position: absolute;
top: 9px" Width="197px" />
<asp:Label ID="lblUName" runat="server" BackColor="Black"
Font-Names="Verdana"
Font-Size="Small" ForeColor="White" Height="22px"
Style="z-index: 105; left: 96px;
position: absolute; top: 11px; text-align: left;"
Width="167px"></asp:Label>
</asp:Panel>
Mark Rae - 21 Jun 2007 18:02 GMT
> I tried the HorizontalAlign="center" and it didn't work
> left: 0px; position: absolute; top: 0px;"
And that's the reason... :-)

Signature
http://www.markrae.net
Mel - 21 Jun 2007 19:48 GMT
> > I tried the HorizontalAlign="center" and it didn't work
> > left: 0px; position: absolute; top: 0px;"
>
> And that's the reason... :-)
>
> --http://www.markrae.net
Okay. So if I had an image on the panel how would I center the image
on the panel?
George Ter-Saakov - 21 Jun 2007 20:46 GMT
what is wrong with old
<center><img src=.....></center>
George
>> > I tried the HorizontalAlign="center" and it didn't work
>> > left: 0px; position: absolute; top: 0px;"
[quoted text clipped - 5 lines]
> Okay. So if I had an image on the panel how would I center the image
> on the panel?
Juan T. Llibre - 21 Jun 2007 21:00 GMT
re:
!> what is wrong with old
!> <center><img src=.....></center>
The center element was deprecated in HTML 4.01.
The center element is not supported in XHTML 1.0 Strict DTD.
You should use CSS styles to center text and/or images.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
> what is wrong with old
> <center><img src=.....></center>
>
> George
>>> > I tried the HorizontalAlign="center" and it didn't work
>>> > left: 0px; position: absolute; top: 0px;"
[quoted text clipped - 5 lines]
>> Okay. So if I had an image on the panel how would I center the image
>> on the panel?
Mark Rae - 21 Jun 2007 21:13 GMT
> what is wrong with old
> <center><img src=.....></center>
Because the <center> tag has been deprecated for ages...
If you use this sort of outdated stuff you really can have no guarantee that
modern browsers will display it correctly.
Use proper XHTML-compliant syntax, and you can be pretty sure that they
will...

Signature
http://www.markrae.net
George Ter-Saakov - 22 Jun 2007 21:38 GMT
Well, from my experience any browser supports <center>
the CSS stlyles.... not so much...
George.
>> what is wrong with old
>> <center><img src=.....></center>
[quoted text clipped - 6 lines]
> Use proper XHTML-compliant syntax, and you can be pretty sure that they
> will...
Mark Rae - 22 Jun 2007 21:57 GMT
> Well, from my experience any browser supports <center>
> the CSS stlyles.... not so much...
You can either live in the past or keep up to date with modern technology...

Signature
http://www.markrae.net