Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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:
 
<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 19-Feb-12 21:33pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

set the margin on left and right of your div tag to auto
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

remove this
MS_POSITIONING="GridLayout"
from body tag
and add align="center"
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

try this code
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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

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:
<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...
  Permalink  
Comments
zyck at 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">
Dawoodelgharib at 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...
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

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

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



Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 26 Feb 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100