locked
Login controls RRS feed

  • Question

  • User-1529183067 posted

    How can I center Login controls? I place them in a div and set Margins to auto but that does not work.

    Friday, November 7, 2014 6:20 PM

Answers

  • User2103319870 posted

    I place them in a div and set Margins to auto but that does not work.

    Add  a wrapper div to your existing div and set the text-align css property to that div.

    Sample Code:

    <div style="text-align: center;">
            <div style="width: 400px; margin-left: auto; margin-right: auto;">
                <asp:Login ID="Login1" runat="server" DestinationPageUrl="~/Yourpage.aspx" TitleText="Enter the Details">
                </asp:Login>
            </div>
        </div>

    Source URL

    Another option is to try using the align property in div.Set the align property to 'center'

     <div align="center">
                <asp:Login ID="Login1" runat="server" DestinationPageUrl="~/Yourpage.aspx" TitleText="Enter the Details">
                </asp:Login>
        </div>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 8, 2014 1:32 AM
  • User71929859 posted

    I place them in a div and set Margins to auto but that does not work.

    You also have to specify a width. Like below

        <div style="margin: auto; width: 270px">
            <asp:Login ID="Login1" runat="server"></asp:Login>
        </div>
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, November 9, 2014 4:00 AM

All replies

  • User-1716253493 posted
    Place it inside <center> </center> or center the div
    Friday, November 7, 2014 6:47 PM
  • User2103319870 posted

    I place them in a div and set Margins to auto but that does not work.

    Add  a wrapper div to your existing div and set the text-align css property to that div.

    Sample Code:

    <div style="text-align: center;">
            <div style="width: 400px; margin-left: auto; margin-right: auto;">
                <asp:Login ID="Login1" runat="server" DestinationPageUrl="~/Yourpage.aspx" TitleText="Enter the Details">
                </asp:Login>
            </div>
        </div>

    Source URL

    Another option is to try using the align property in div.Set the align property to 'center'

     <div align="center">
                <asp:Login ID="Login1" runat="server" DestinationPageUrl="~/Yourpage.aspx" TitleText="Enter the Details">
                </asp:Login>
        </div>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 8, 2014 1:32 AM
  • User71929859 posted

    I place them in a div and set Margins to auto but that does not work.

    You also have to specify a width. Like below

        <div style="margin: auto; width: 270px">
            <asp:Login ID="Login1" runat="server"></asp:Login>
        </div>
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, November 9, 2014 4:00 AM
  • User-1529183067 posted

    RESOLVED

    Sunday, November 9, 2014 5:28 PM