Issue to div part

Peter_1985 2,866 Reputation points
2021-12-31T01:45:24.683+00:00

Hi,
How to ensure all Textbox, buttons are well placed within one div frame on the page, while the div is also centered on the page?
161542-4f.png

Developer technologies | ASP.NET | Other
{count} votes

Answer accepted by question author
  1. Lan Huang-MSFT 30,206 Reputation points Microsoft External Staff
    2021-12-31T03:26:57.103+00:00

    Hi @Peter_1985 ,
    You only need to place all the text boxes and buttons in the div. Regarding the div is located in the center of the page, you can use css, you can refer to the following code.

    <body>  
        <form id="form1" runat="server">  
      
              <div class="centered">  
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>  
                <asp:Button ID="Button1" runat="server" Text="Button" />  
              </div>  
        
        </form>  
    </body>  
    </html>  
    <style>  
        .centered {  
            position: absolute;  
            margin: auto;  
            top: 0;  
            right: 0;  
            bottom: 0;  
            left: 0;  
            width: 300px;  
            height: 300px;  
            text-align: center;  
            background-color: blue;  
        }  
    </style>  
    

    161573-1.png
    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.