How to center Login control on a page?

Discussion in 'ASP .Net' started by dan, May 5, 2008.

  1. dan

    dan Guest

    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
     
    dan, May 5, 2008
    #1
    1. Advertising

  2. dan

    ADN Guest

    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>
     
    ADN, May 5, 2008
    #2
    1. Advertising

  3. dan

    Rob Eventine Guest

    Or you could use this;

    <center>
    Login controls
    </center>

    it works for me


    "dan" <> wrote in message
    news:...
    > 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
    >
    >
     
    Rob Eventine, May 5, 2008
    #3
  4. dan

    dan Guest

    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

    "ADN" <> wrote in message
    news:...
    > 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>
    >
    >
    >
     
    dan, May 5, 2008
    #4
  5. dan

    ADN Guest

    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.
     
    ADN, May 5, 2008
    #5
  6. <div style="width:200px; margin-left:auto; margin-right:auto">
    <your login control />
    </div>

    "dan" <> a écrit dans le message de news:
    ...
    > 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
    >
    >
     
    Mike Gleason jr Couturier, May 6, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ike2010
    Replies:
    0
    Views:
    680
    ike2010
    Nov 15, 2005
  2. Sasquatch
    Replies:
    2
    Views:
    1,325
    Sasquatch
    Oct 3, 2006
  3. trint
    Replies:
    4
    Views:
    420
    trint
    Sep 22, 2007
  4. Shannon

    login page stays on login page

    Shannon, Jan 9, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    552
    Shannon
    Jan 9, 2008
  5. tinzo

    Center Login Control and Firefox

    tinzo, Aug 20, 2006, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    147
Loading...

Share This Page