HTML Form Align - html

I'm struggling to get the content of my div to align, everything will center apart from the contents of the table. The title will center along with the login button.
CSS:
.center {
margin:auto;
width: 50%;
border:3px solid #8AC007;
padding: 10px;
-moz-border-radius:8px;
-webkit-border-radius:8px;
font-family:'Century Gothic';
text-align:center;
}
HTML:
<div class="center">
<form id="form1" runat="server">
<h3>
Login Page</h3>
<table >
<tr>
<td>
E-mail address:</td>
<td>
<asp:TextBox ID="UserEmail" runat="server" /></td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
ControlToValidate="UserEmail"
Display="Dynamic"
ErrorMessage="Required"
runat="server" />
</td>
</tr>
<tr>
<td>
Password:</td>
<td>
<asp:TextBox ID="UserPass" TextMode="Password"
runat="server" />
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
ControlToValidate="UserPass"
ErrorMessage="Cannot be empty."
runat="server" />
</td>
</tr>
<tr>
<td>
Remember me?</td>
<td>
<asp:CheckBox ID="Persist" runat="server" /></td>
</tr>
</table>
<asp:Button ID="Submit1" OnClick="Logon_Click" Text="Login"
runat="server" />
<p>
<asp:Label ID="Msg" ForeColor="red" runat="server" />
</p>
</form>
</div>
I've tried text align on the table as well with no luck

Apply margin: 0 auto to the table element. Currently your margin: auto only centers the form but inside it the table is aligned to the left because of the default behavior of contents to start from left.
Don't try to use tables for layout purpose, although you can use them for tabular data.
.center {
margin: auto;
width: 50%;
border: 3px solid #8AC007;
padding: 10px;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
font-family: 'Century Gothic';
text-align: center;
}
table {
margin: 0 auto; /* Add */
}
<div class="center">
<form id="form1" runat="server">
<h3>
Login Page</h3>
<table>
<tr>
<td>
E-mail address:</td>
<td>
<asp:TextBox ID="UserEmail" runat="server" />
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="UserEmail" Display="Dynamic" ErrorMessage="Required" runat="server" />
</td>
</tr>
<tr>
<td>
Password:</td>
<td>
<asp:TextBox ID="UserPass" TextMode="Password" runat="server" />
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="UserPass" ErrorMessage="Cannot be empty." runat="server" />
</td>
</tr>
<tr>
<td>
Remember me?</td>
<td>
<asp:CheckBox ID="Persist" runat="server" />
</td>
</tr>
</table>
<asp:Button ID="Submit1" OnClick="Logon_Click" Text="Login" runat="server" />
<p>
<asp:Label ID="Msg" ForeColor="red" runat="server" />
</p>
</form>
</div>

Related

ASPX page not showing up in any browser

I am developing an aspx page, almost everything works fine if vb-design, but nothing showing up in IE, Firefox, Chrome...I can't open the page in any browser...so I can manage to see my project. But I can't run it, I don't know where to look or what to do.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 60%;
border-collapse: collapse;
border-style: solid;
border-width: 2px;
}
.auto-style2 {
text-decoration: underline;
}
.auto-style3 {
width: 1006px;
border-collapse: collapse;
}
.auto-style4 {
width: 194px;
}
.auto-style5 {
width: 194px;
height: 122px;
}
.auto-style6 {
height: 122px;
width: 600px;
}
.auto-style7 {
width: 600px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td><asp:Label runat="server" ID="lblLastName" Text="Last name"></asp:Label></td>
<td>
<asp:TextBox ID="txtLastName" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Label ID="lblFirstName" runat="server" Text="First Name"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblOfferDate" runat="server" Text="Offer date"></asp:Label>
</td>
<td>
<asp:Calendar ID="calOfferDate" runat="server" BackColor="White" BorderColor="#999999" CellPadding="4" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" Height="180px" Width="200px">
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
<NextPrevStyle VerticalAlign="Bottom" />
<OtherMonthDayStyle ForeColor="#808080" />
<SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
<SelectorStyle BackColor="#CCCCCC" />
<TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
<TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
<WeekendDayStyle BackColor="#FFFFCC" />
</asp:Calendar>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblOfferExpirationDate" runat="server" Text="Offer expiration date"></asp:Label>
</td>
<td>
<asp:Calendar ID="calOfferExpirationDate" runat="server" BackColor="White" BorderColor="#999999" CellPadding="4" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" Height="180px" Width="200px">
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
<NextPrevStyle VerticalAlign="Bottom" />
<OtherMonthDayStyle ForeColor="#808080" />
<SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
<SelectorStyle BackColor="#CCCCCC" />
<TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
<TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
<WeekendDayStyle BackColor="#FFFFCC" />
</asp:Calendar>
</td>
</tr>
</table>
<hr />
<br />
<span class="auto-style2"><strong>Set up your car
<br />
</strong>
<table class="auto-style3">
<tr>
<td class="auto-style4">
<asp:Label ID="lblEquipmentLevel" runat="server" Text="Equipment level"></asp:Label>
</td>
<td class="auto-style7">
<asp:DropDownList ID="cbEquipmentLevel" runat="server">
<asp:ListItem Selected="True">Standard</asp:ListItem>
<asp:ListItem>Evolved</asp:ListItem>
<asp:ListItem>Advanced</asp:ListItem>
<asp:ListItem>Premium</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="auto-style4">
<asp:Label ID="lblWarrantyType" runat="server" Text="Warranty type"></asp:Label>
</td>
<td class="auto-style7">
<asp:RadioButtonList ID="rblWarrantyList" runat="server">
<asp:ListItem Selected="True">Standard (2 years)</asp:ListItem>
<asp:ListItem>Extended (5 years)</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td class="auto-style5">
<asp:Label ID="lblOptionals" runat="server" Text="Optionals"></asp:Label>
</td>
<td class="auto-style6">
<asp:RadioButtonList ID="rblOptionals" runat="server" AutoPostBack="True">
<asp:ListItem Selected="True">Yes</asp:ListItem>
<asp:ListItem>No</asp:ListItem>
</asp:RadioButtonList>
<asp:CheckBoxList ID="cblOptionals" runat="server" RepeatDirection="Horizontal" Width="727px">
<asp:ListItem>Alloys wheels</asp:ListItem>
<asp:ListItem>Climatronic</asp:ListItem>
<asp:ListItem>Automatic pilot</asp:ListItem>
<asp:ListItem>Road alert</asp:ListItem>
<asp:ListItem>Navigation</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td class="auto-style4">
<asp:Label ID="lblDiscounts" runat="server" Text="Discounts"></asp:Label>
</td>
<td class="auto-style7"><strong>
<asp:Label ID="lblWholepayment" runat="server" Text="Whole payment"></asp:Label>
</strong>
<asp:CheckBox ID="cbWhole" runat="server" />
<strong>
<asp:Label ID="lblCasco" runat="server" Text="CASCO Insurance"></asp:Label>
</strong>
<asp:CheckBox ID="cbCasco" runat="server" />
</td>
</tr>
<tr>
<td class="auto-style4"> </td>
<td class="auto-style7">
<asp:Button ID="btnDiplayOffer" runat="server" BackColor="Red" BorderColor="White" ForeColor="White" Text="Display Offer" />
</td>
</tr>
</table>
</span>
</div>
<asp:Label ID="LblMessage" runat="server" ></asp:Label>
</form>
</body>
</html>

How to change position of a specfic <td> element inside a HTML table

So, I have this table in which I need to place the td that contains the profile info further to the right as following:
Example
this is my HTML:
<table>
<tr>
<td>
<asp:Label ID="****" runat="server" CssClass="FieldLabelRqrd" Text="Name"></asp:Label>
</td>
<td>
<asp:Label ID="***" runat="server" Text="ID=****"></asp:Label>
</td>
<td colspan="4">
<div id="cssProfile">
<asp:Label ID="lblProfile" runat="server" Text="Profile:" CssClass="lblProfile"></asp:Label>
<asp:HyperLink ID="hlGoProfile" runat="server" ForeColor="blue" Target="_blank" CssClass="hlGoProfile" Text="Go"></asp:HyperLink>
</div>
</td>
</tr>
</table>
I tried colspan and rowspan but this does no work and here's the CSS
#cssProfile{
display:flex;
justify-content: start-flex;}
.lblProfile{
margin-left: auto;}
.hlGoProfile{
margin-left: auto;}
Give your table 100% width and add text-align: right to the cell in question.
BTW, you could remove that colspan, if you don't need it for any other purpose.
table {
width: 100%;
}
#cssProfile {
border: 1px solid red;
text-align: right;
}
<table>
<tr>
<td>
<asp:Label ID="****" runat="server" CssClass="FieldLabelRqrd" Text="Name">A</asp:Label>
</td>
<td>
<asp:Label ID="***" runat="server" Text="ID=****">B</asp:Label>
</td>
<td colspan="4">
<div id="cssProfile">
<asp:Label ID="lblProfile" runat="server" Text="Profile:" CssClass="lblProfile">C</asp:Label>
<asp:HyperLink ID="hlGoProfile" runat="server" ForeColor="blue" Target="_blank" CssClass="hlGoProfile" Text="Go">D</asp:HyperLink>
</div>
</td>
</tr>
</table>

Reduce space between two td's

I have a table in which there are many tr and td's
Currently it looks like this in the below image.
The area in the arrow needs to be reduced a bit. I tried adding padding but it didn't worked.
Below is the html
<table width="100%" border="0" cellspacing="0" cellpadding="5" style="background-color: #EAEFF5">
<tr>
<td class="label">
Project :
</td>
<td class="field" style="width: 10%;">
<asp:DropDownList ID="ddlProject" runat="server" Width="80%" AutoPostBack="false">
<asp:ListItem Value="0">--Select--</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="label">
Taluka :
</td>
<td class="field">
<%--<asp:TextBox ID="txtTaluka" runat="server" Width="80%"></asp:TextBox>--%>
<asp:DropDownList ID="ddlTaluka" runat="server" Width="80%">
<%--<asp:ListItem Value="0">--Select--</asp:ListItem>--%>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="label">
Transaction Type:
</td>
<td class="field" style="width: 30%;">
<asp:DropDownList ID="ddlTranType" runat="server" Width="50%" AutoPostBack="true"
OnSelectedIndexChanged="ddlTranType_SelectedIndexChanged">
<asp:ListItem Value="0">--Select--</asp:ListItem>
<asp:ListItem Value="AGR">Agreement Type</asp:ListItem>
<asp:ListItem Value="EXP">Expense Type</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="label">
7/12 :
</td>
<td class="field" style="width: 30%;">
<%--<obout:ComboBox ID="ComboBox1" runat="server" Width="180px" Height="150px" AutoClose="false"
AllowCustomText="true" AutoValidate="true" AllowEdit="false" SelectionMode="Multiple"
DataTextField="COLUMN7_12" DataValueField="COLUMN7_12" OpenOnFocus="true" EmptyText="Select 7/12 ..."
EnableVirtualScrolling="true" EnableLoadOnDemand="true" OnLoadingItems="ComboBox1_LoadingItems"
Visible="true">
<ClientSideEvents OnItemClick="ComboBox1_Click" />
<ItemTemplate>
<input type="checkbox" runat="server" id="chk712" />
<%# Container.Text %>
</ItemTemplate>
<FooterTemplate>
Displaying items
<%# Container.ItemsCount > 0 ? "1" : "0" %>-<%# Container.ItemsLoadedCount %>out
of
<%# Container.ItemsCount %>.
</FooterTemplate>
</obout:ComboBox>--%>
<asp:TextBox ID="txt712" runat="server" Width="60%"></asp:TextBox>
<br />
<i>Start typing...</i>
</td>
</tr>
<tr>
<td class="label">
Ref No :
</td>
<td class="field" style="width: 30%;">
<input type="text" id="txtrefno" runat="server" style="width: 60%" />
<img src="~/Images/search.gif" alt="Help" onclick="Search_Click()" style="cursor: pointer"
id="ImgSearch" runat="server" /><br />
<span style="color: #1B1E24;">(Auto Generated field)</span>
</td>
<td class="label">
Status :
</td>
<td class="field" style="width: 30%;">
<asp:DropDownList ID="ddlStatus" runat="server" Width="50%" AutoPostBack="false">
<asp:ListItem Value="0">--Select--</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="label">
Ref Date :
</td>
<td class="field" style="width: 30%;">
<input type="text" id="txtRefdate" runat="server" style="width: 60%" disabled="disabled" />
<%--<cc3:Calendar ID="CalDt1" runat="server" DatePickerMode="true" DatePickerImagePath="../Images/icon2.gif"
TextBoxId="txtRefdate" Enabled="true" CultureName="en-GB" DateFormat="dd/MM/yyyy">
</cc3:Calendar>--%>
</td>
<td class="label">
Transaction Date :
</td>
<td class="field" style="width: 30%;">
<input type="text" id="txtdate" runat="server" style="width: 50%" readonly="readonly" />
<cc3:Calendar ID="Calc2" runat="server" DatePickerMode="true" DatePickerImagePath="../Images/icon2.gif"
TextBoxId="txtdate" Enabled="true" CultureName="en-GB" DateFormat="dd/MM/yyyy">
</cc3:Calendar>
</td>
</tr>
<tr>
<td class="label">
Remarks :
</td>
<td>
<asp:TextBox ID="txtRemarks" runat="server" Width="80%" TextMode="MultiLine"></asp:TextBox>
</td>
</tr>
</table>
CSS
.label
{
width: 20%;
height: 10%;
}
.field
{
width: 30%;
height: 10%;
}
Fiddle of the html
I'd say you should remove the cellpadding property from the table and do that via css as well.
increased or decreased the padding to adjust the space between two td's
.field, .label {
padding: 2px;
}
I modified your jsfiddle https://jsfiddle.net/g0oyxfqs/2/
table tr:first-child td {
padding-bottom: 1px; // insert total padding length here
}
table tr:nth-child(2) td {
padding-top: 0;
}

How to change slightly view in asp page?

I have this asp code:
<table>
<tr>
<td>Text:
</td>
<td>
<asp:TextBox ID="txtDescPoint" runat="server" EnableViewState="False" />
</td>
<td>
<input type="button" value="..." id="ffcolorswtach" style="width: 20px; height: 23px;color: #ffffffff; background-color: #ffffffff" onclick="PickColor(1, false, false)" role="button"/>
</td>
</tr>
<tr>
<td>X:
</td>
<td>
<asp:TextBox ID="txtLon" runat="server" EnableViewState="False" />
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtLon" Display="Dynamic" ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>Y:
</td>
<td>
<asp:TextBox ID="txtLat" runat="server" EnableViewState="False" />
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txtLat" Display="Dynamic" ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
Here how it looks in view:
I need the view like this:
My question is what do I have to change in asp code to make appearance like in picture above?
I'm new to ASP, but I think you can just use CSS/html styling principles.
In
<input type="button" value="..." id="ffcolorswtach" style="width: 20px; height: 23px;color: #ffffffff; background-color: #ffffffff" onclick="PickColor(1, false, false)" role="button"/>
add this somewhere between the quotes after style=
left: 80px; //play with the amount to find what works.
If you're unable to get the button close enough, it may be because the textbox has padding or margin around it. Search your css files for a reference to #txtDescPoint and edit the padding/margin attribute if it has one.

td data not aligning properly

I am new to Html designing. There is a small section of page that I have to design using html and CSS.
I have the back ground image with the image of login button. How to develop the Html of this so that it looks the same form in the attached picture.
Till now I have tried this but it is looking distorted:
<div class="dvEmployee">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<br />
<span class="EmployeeLable">Enter your employee number to vote </span>
</td>
</tr>
<tr>
<td>
<asp:TextBox runat="server" ID="txtEmpID" ValidationGroup="vdLog" CssClass="input"
Height="49px" Width="161px" /><br />
<asp:RequiredFieldValidator ID="rfgEmp" runat="server" ValidationGroup="vdLog" ControlToValidate="txtEmpID"
ErrorMessage="Please enter employee number!"></asp:RequiredFieldValidator>
<asp:Label runat="server" ID="lblError" Text="" CssClass="lblError"></asp:Label>
</td>
<td>
<asp:ImageButton ID="imgBtn" runat="server" ImageUrl="Images/log_in_button.png" ValidationGroup="vdLog"
AlternateText="Log In" OnClick="imgBtn_Click" />
</td>
</tr>
</table>
</div>
Css classes that I have made:
.dvEmployee
{
background-image: url('images/log_in_window.png');
background-repeat: no-repeat;
width: 466px;
height: 206px;
position: relative; /* padding: 100px 30px;*/
margin: 180px 107px;
z-index: 2000px;
}
.lblError
{
font: Arial Regular 12pt #000000;
}
.EmployeeLable
{
font-family: Arial regular;
font-size: 29pt;
color: #404040;
line-height: 17px;
}
Just to give all, following image is how it is currently looking:
use this srtuctuer :
<table>
<tr>
<td colspan="2">
<br />
<span class="EmployeeLable">Enter your employee number to vote </span>
</td>
</tr>
<tr>
<td class="center">
<asp:TextBox runat="server" ID="txtEmpID" ValidationGroup="vdLog" CssClass="input"
Height="49px" Width="161px" /><br />
<asp:RequiredFieldValidator ID="rfgEmp" runat="server" ValidationGroup="vdLog" ControlToValidate="txtEmpID"
ErrorMessage="Please enter employee number!"></asp:RequiredFieldValidator>
<asp:Label runat="server" ID="lblError" Text="" CssClass="lblError"></asp:Label>
</td>
<td class="center">
<asp:ImageButton ID="imgBtn" runat="server" ImageUrl="Images/log_in_button.png" ValidationGroup="vdLog"
AlternateText="Log In" OnClick="imgBtn_Click" />
</td>
</tr>
</table>
css :
.center{
text-align:center;
}