Click here to Skip to main content
15,883,854 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Greetings..

i designed a page using ASP.Net on Visual Studio 2003, but it is always loaded in the left of any browser so now I want to load it at the center of the browsers (IE, Firefox, Chrome,..) and I have the following html:

XML
<body MS_POSITIONING="GridLayout">
    <div align="center">
        <form id="Form1" method="post" runat="server">
            <asp:Image style="Z-INDEX: 100; POSITION: absolute; TOP: 272px; LEFT: 8px" id="TopImage" runat="server"
                Width="1030px" Height="600px" ImageUrl="file:///C:\Documents and Settings\Dgharib\Desktop\Images Repository\world-map-background1.jpg"></asp:Image>
           <asp:Label style="Z-INDEX: 105; POSITION: absolute; TOP: 312px; LEFT: 144px" id="lbHome" runat="server"
                Height="522px" Width="824px" BackColor="Transparent" ForeColor="Yellow">Home</asp:Label>
            <asp:Button style="Z-INDEX: 107; POSITION: absolute; TOP: 272px; LEFT: 232px" id="btnHome" runat="server"
                Height="24px" Width="120px" Text="Home" BackColor="CornflowerBlue" ForeColor="White" BorderStyle="Double"></asp:Button>
        </form>
    </div>
</body>



So as shown in this html I used
...
but still the page is loaded in the left of the browser plus it loads correctly in IE only and not in other browser....


Please advise...

Thanks in advance...
Posted

Have you had a look at CSS Horizontal alignment methods by setting style properties?

http://www.w3schools.com/css/css_align.asp[^]

Worth a read, and may help you achieve your goal.
 
Share this answer
 
set the margin on left and right of your div tag to auto
 
Share this answer
 
remove this
MS_POSITIONING="GridLayout"
from body tag
and add align="center"
 
Share this answer
 
try this code
ASP.NET
add style to your form ...>
 <form id="Form1" style="magin:10px auto; with:960px;" method="post" runat="server">

vote or accept solution
if this will help you
thanks
 
Share this answer
 
Thx Guys but still there is no solution to my case....

@ FrostedSyntax: I don`t know how to do that..could you please mention how you set the margin on left and right of your div tag to auto?

@Technoses: There is no align attribute for element body..So please could you be more clear on where to add align="center"

@zyck: i wonder how this will solve my issue..I tried the wollowing two options and never get a solution:
ASP.NET
<form id="Form1" style="magin:10px auto; with:960px;" method="post" runat="server">
<form id="Form1" style="margin:10px auto; with:960px;" method="post" runat="server">


So what should I do...please advise...
 
Share this answer
 
Comments
zyck 20-Feb-12 9:43am    
try to comment out this code

<asp:Image style="Z-INDEX: 100; POSITION: absolute; TOP: 272px; LEFT: 8px" id="TopImage" runat="server"
Width="1030px" Height="600px" ImageUrl="file:///C:\Documents and Settings\Dgharib\Desktop\Images Repository\world-map-background1.jpg">
dgthecodeproject 22-Feb-12 0:13am    
I don`t know what you are trying to do Zyck...but I I commented this and never get my solution....Thanks for your try...
Greetings,

Thx guys for your tries, but I really need this help from you...

I think you`ve already program this..just need to load my webpage created in Visual Studio 2003 (ASP.Net (VB code)) to be in the middle (only horizontally) when it loads in a browser... and this in the sake to have adds (i.e adsense from google) in the left & right sides of my page (content)...


Please advise...

I know you`ve experienced and it may be v.silly but plz provide me with a solution or just a hint....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900