How to center Login control on a page?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dan

    How to center Login control on a page?

    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


  • ADN

    #2
    Re: How to center Login control on a page?

    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="myCla ss"></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>



    Comment

    • Rob Eventine

      #3
      Re: How to center Login control on a page?

      Or you could use this;

      <center>
      Login controls
      </center>

      it works for me


      "dan" <dan@company.co mwrote in message
      news:OUnMc4rrIH A.5068@TK2MSFTN GP02.phx.gbl...
      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
      >
      >

      Comment

      • Mark Rae [MVP]

        #4
        Re: How to center Login control on a page?

        "Rob Eventine" <btb101@ntlworl d.comwrote in message
        news:xYFTj.8282 $WA5.7038@newsf e6-gui.ntli.net...

        [top-posting corrected]
        >Could someone please let me know how to center a Login control on a page?
        >>
        >Can I use CSS to do that?
        >
        Or you could use this;
        >
        <center>
        Login controls
        </center>
        The <centertag has been deprecated for ages and should not be used...
        it works for me
        On what browser(s) / platform(s) have you tested it...?


        --
        Mark Rae
        ASP.NET MVP


        Comment

        • dan

          #5
          Re: How to center Login control on a page?

          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" <vcuankit@gmail .comwrote in message
          news:969ccc3b-b233-45cf-9e75-5bcea4b1c7a5@26 g2000hsk.google groups.com...
          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="myCla ss"></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>
          >
          >
          >

          Comment

          • ADN

            #6
            Re: How to center Login control on a page?

            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 <centertag at all. It's
            bad practice and it probably isn't browser compatible with all
            browsers.

            Comment

            • Mike Gleason jr Couturier

              #7
              Re: How to center Login control on a page?

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

              "dan" <dan@company.co ma écrit dans le message de news:
              OUnMc4rrIHA.506 8@TK2MSFTNGP02. phx.gbl...
              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
              >
              >

              Comment

              Working...