Center web page info

M

Mel

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)
 
B

Ben Rush

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.


--
~~~~~~~~~~~~~~~~~~~~~~~~~~
Ben Rush
Microsoft .NET Consultant
http://www.ben-rush.net/blog
http://www.sideshowsystems.com
 
M

Mark Rae

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>
 
M

Mel

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.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~
Ben Rush
Microsoft .NET Consultanthttp://www.ben-rush.net/bloghttp://www.sideshowsystems.com








- 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.
 
M

Mel

<asp:panel ID="MyPanel" runat="server" HorizontalAlign="center">

</asp:panel>

or

<div style="margin-left:auto;margin-right:auto;">

</div>

--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>
&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;
&nbsp; &nbsp;&nbsp;
<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>
 
J

Juan T. Llibre

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.
 
M

Mark Rae

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...
 
G

George Ter-Saakov

Well, from my experience any browser supports <center>
the CSS stlyles.... not so much...


George.
 
M

Mark Rae

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...
 

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

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,194
Latest member
KarriWhitt

Latest Threads

Top