<center> and Style=Position:absolute

J

jobs

This might be an ASP.NET question.

I have a simple login page with roughly a 300px x 300px image behind
the asp.net login control. I need the login control to land in the
middle of the image. I want both the image and the login controlrol to
always be in the center of the page. How can I do this?

I use position:absolute to get the asp.net login control on top of
the image, but then when the IE window size is changed (by the user)
the login control does not center. Here's my markup code:



<form id="form1"
runat="server">
<br /
<center>


<div>
<img src="App_Themes/Retailer/images/
retaillogin.GIF" />

<asp:Login ID="Login" runat="server"
DestinationPageUrl="~/Main/Default.aspx"
Style="position: absolute; left: 278px; top:
188px" Height="152px" Width="327px">
</
asp:Login>
<asp:Button ID="RecoverPassword" runat="server"
Text="Recover Password"

PostBackUrl="RecoverPass.aspx" Style="left: 286px; position:
absolute; top: 319px"
Width="100px" /
</
div>
</
center>
</form>

Thanks for any help or information.
 
M

Matt White

This might be an ASP.NET question.

I have a simple login page with roughly a 300px x 300px image behind
the asp.net login control. I need the login control to land in the
middle of the image. I want both the image and the login controlrol to
always be in the center of the page. How can I do this?

I use position:absolute to get the asp.net login control on top of
the image, but then when the IE window size is changed (by the user)
the login control does not center. Here's my markup code:

<form id="form1"
runat="server">
<br /



<center>

<div>
<img src="App_Themes/Retailer/images/
retaillogin.GIF" />

<asp:Login ID="Login" runat="server"
DestinationPageUrl="~/Main/Default.aspx"
Style="position: absolute; left: 278px; top:
188px" Height="152px" Width="327px">
</
asp:Login>
<asp:Button ID="RecoverPassword" runat="server"
Text="Recover Password"

PostBackUrl="RecoverPass.aspx" Style="left: 286px; position:
absolute; top: 319px"
Width="100px" /



</
div>
</
center>
</form>

Thanks for any help or information.

Here's a simple example that I think is what you want. You can copy it
to an html file and see if it's correct. The relative positioning will
position the word "LOGIN" relative to where it would normally be.
(Take the style line out of the div tag to see where it would normally
be.) Use the top: directive to tell it exactly where to go from its
normal position.

<html>
<head>
<title>none</title>
</head>
<body>
<center>
<div>
<img src="noimage.gif" width=300 height=300 />
<div style="position:relative;top:-156px;">LOGIN</div>
</div>
</center>
</body>
</html>
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top