How to center Login control on a page?

D

dan

Hi,

Could someone please let me know how to center a Login control on a page?

Can I use CSS to do that?

Thanks,
Dan
 
A

ADN

Hi dan,

You could use the CssClass property of the login control to style your
login control and position it:

<asp:Login runat="server" id="myLogin" CssClass="myClass"></asp:Login>

Additionally, you could also wrap your LoginControl in a div and then
position your div on the page wherever you'd like it using a css class

<div class="myClass"><asp:Login runat="server" id="myLogin"></
asp:Login></div>
 
D

dan

Thanks for the reply.

I'm still strugling with it. The css applied to the login control seems to
re-arrange controls within the login but does not actually center the
'whole' login control. Would you able to provide a simple example?

Thanks,
Dan
 
A

ADN

Hey Dan,

If your css class moves all of the controls around, then you could try
the second approach of wrapping the login control in a div like so:

<style>
..myClass{ margin-right: 25%; }
</style>

<div class="myClass"><asp:Login runat="server" id="myLogin"></
asp:Login></div>

I agree with Mark, you shouldn't be using a <center> tag at all. It's
bad practice and it probably isn't browser compatible with all
browsers.
 
M

Mike Gleason jr Couturier

<div style="width:200px; margin-left:auto; margin-right:auto">
<your login control />
</div>
 

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,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top