javascript - How to center align the actual TextBox in Asp.net website -
i have following html/asp code want center textbox on display page. attaching code below. preferably want see label beside textbox once in center.
<center> <div class="container" id="textbox4" runat="server" width="181px" bordercolor="black" borderstyle="solid"> <div class="row"> <div class='col-sm-6'> <div class="form-group"> <div class='input-group date' id='datetimepicker1'> <p style="color: #000000; font-weight: bold; "> start date , time <asp:textbox id="tb4" runat="server" cssclass="form-control" width="374px" style="text-align: center"> </asp:textbox></p> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </div> <script type="text/javascript"> $(function () { $('#datetimepicker1').datetimepicker(); }); </script> </div> </div></center>
try code. remove id=tb4 width , add class.
<%@ page language="c#" autoeventwireup="true" codebehind="webform1.aspx.cs" inherits="webapplication11.webform1" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link href="content/bootstrap.css" rel="stylesheet" /> </head> <body> <form id="form1" runat="server"> <div class="container" id="textbox4" runat="server" width="181px" bordercolor="black" borderstyle="solid"> <div class="row"> <div class='col-lg-12'> <div class="row"> <div class="form-group"> <div class="col-lg-4"> </div> <div class="col-lg-4"> <div class='input-group date' id='datetimepicker1'> <div class="text-center"> <p style="color: #000000; font-weight: bold;"> start date , time <asp:textbox id="tb4" runat="server" cssclass="form-control" style="text-align: center"> </asp:textbox> </p> </div> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <div class="col-lg-4"> </div> </div> </div> </div> </div> </div> </form> </body> </html>
Comments
Post a Comment