adjust the textbox size same as table th size equal - html

I have a four text boxes and one fa icon and below there is a table.what I want is
text size width should be equal to the table header column size. I have tried all the ways but it is not working.How can i fix that.any help would be appreciated Thanks in Advance.
th {
border-bottom: 1px solid black;
}
th,
td {
border-collapse: collapse;
}
tr:nth-child(odd) {
background-color: #dddddd;
}
td {
padding: 7px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<div id="a12" style="float:left;width:100%;text-align:left;margin:5px 0px 0px 10px;">
<div style="float:left;width:26%;">
<input type="hidden" id="num" name="ctid" />
<input type="text" id="name" name="vendornamegr" value="" style="width:95%;height:25px;font-size:15px;" />
</div>
<div style="float:left;width:23%;">
<input type="text" id="designation" name="designation" value="" style="width:95%;height:25px;font-size:15px;" required />
</div>
<div style="float:left;width:12%;padding-left:2%;">
<input type="text" id="mobilegr" name="mobilegr" value="" minlength="10" maxlength="10" style="height:25px;font-size:15px;" required/>
</div>
<div style="float:left;width:22%;padding-left:4%;">
<input type="email" id="maildgr" name="mailidgr" value="" style="width:105%;height:25px;font-size:15px;" required/>
</div>
<div class="txtcbt" style="float:left;width:5%;padding-left:4%;">
<i class="fa fa-plus" style="font-size:25px;color:white;background-color:#dc143c;"></i>
</div>
</div>
<div id="tables" class="scrollingTable" style="float:left;max-height:175px;max-width:99%;overflow: auto;margin:6px 0px 0px 7px;text-align:left;">
<table id=cnttable style="width:100%;font-size:17px;">
<thead>
<tr>
<th style="width:38%;text-align:center;font-size:17px;">Name</th>
<th style="width:20%;text-align:center;font-size:17px;">Designation</th>
<th style="width:15%;text-align:center;font-size:17px;">Mobile</th>
<th style="width:24%;text-align:center;font-size:17px;">Email-Id</th>
<th style="width:5%;text-align:center;font-size:17px;">Edit</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>

I have updated your code with lot of changes. Like removing unwanted styles and added new styles and make it looks like what you expected.
HTML
<div id="a12" style="float:left;width:100%;text-align:left; margin-bottom:10px;">
<div style="float:left;width:36%;">
<input type="hidden" id="num" name="ctid" />
<input type="text" id="name" name="vendornamegr" value="" style="width:90%;height:25px;font-size:15px;" />
</div>
<div style="float:left;width:20%;">
<input type="text" id="designation" name="designation" value="" style="width:90%;height:25px;font-size:15px;" required />
</div>
<div style="float:left;width:15%;">
<input type="text" id="mobilegr" name="mobilegr" value="" minlength="10" maxlength="10" style="width:90%; height:25px;font-size:15px;" required/>
</div>
<div style="float:left;width:24%;">
<input type="email" id="maildgr" name="mailidgr" value="" style="width:90%;height:25px;font-size:15px;" required/>
</div>
<div class="txtcbt" style="float:left;width:5%;">
<i class="fa fa-plus" style="font-size:25px;color:white;background-color:#dc143c;"></i>
</div>
</div>
<div id="tables" class="scrollingTable" style="max-height:175px;overflow: auto; width:100%;">
<table cellspacing="0" cellpadding="0" id=cnttable>
<thead>
<tr>
<th style="width:36%;text-align:center;font-size:17px;">Name</th>
<th style="width:20%;text-align:center;font-size:17px;">Designation</th>
<th style="width:15%;text-align:center;font-size:17px;">Mobile</th>
<th style="width:24%;text-align:center;font-size:17px;">Email-Id</th>
<th style="width:5%;text-align:center;font-size:17px;">Edit</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
CSS
table {
box-sizing:border-box;
width:100%;
border-top: 1px solid black;
border-left:1px solid black;
}
th {
border-bottom: 1px solid black;
border-right:1px solid black;
}
th, td {
border-collapse: collapse;
}
tr:nth-child(odd) {
background-color: #dddddd;
}
#a12 > div {
text-align:center;
}
DEMO

Try this way too. I just changed some of your width sizes.
CSS
th {
border-bottom: 1px solid black;
}
th,
td {
border-collapse: collapse;
}
tr:nth-child(odd) {
background-color: #dddddd;
}
td {
padding: 7px;
}
CODE
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<div id="a12" style="float:left;width:100%;text-align:left;overflow: auto;margin:5px 0px 0px 10px;">
<div style="float:left;width:30%;">
<!-- <input type="hidden" id="num" name="ctid" /> -->
<input type="text" id="name" name="vendornamegr" value="" style="width:99%;height:25px;font-size:15px;" />
</div>
<div style="float:left;width:25%;">
<input type="text" id="designation" name="designation" value="" style="width:99%;height:25px;font-size:15px;" required />
</div>
<div style="float:left;width:15%;%;">
<input type="text" id="mobilegr" name="mobilegr" value="" minlength="10" maxlength="10" style="height:25px;font-size:15px;" required/>
</div>
<div style="float:left;width:25%;">
<input type="email" id="maildgr" name="mailidgr" value="" style="width:99%;height:25px;font-size:15px;" required/>
</div>
<div class="txtcbt" style="float:left;width:5%;">
<i class="fa fa-plus" style="font-size:25px;color:white;background-color:#dc143c;"></i>
</div>
</div>
<div id="tables" class="scrollingTable" style="float:left;max-height:175px;width:100%;overflow: auto;margin:6px 0px 0px 7px;text-align:left;">
<table id=cnttable style="width:100%;font-size:17px;">
<thead>
<tr>
<th style="width:30%;text-align:center;font-size:17px;">Name</th>
<th style="width:25%;text-align:center;font-size:17px;">Designation</th>
<th style="width:15%;text-align:center;font-size:17px;">Mobile</th>
<th style="width:25%;text-align:center;font-size:17px;">Email-Id</th>
<th style="width:5%;text-align:center;font-size:17px;">Edit</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>

Related

How can I align this input button in the center of the table row?

I understand that this is a very basic question, but I've searched stackoverflow and I cannot find a question that helps me solve my own issue. I am trying to center align the contents (an input with type="submit") of a table cell (td element). I can center the contents in the cell, but the cell itself is not stretching the width of the table. I cannot find any css attribute that helps me to spread this td element the width of the table. How can I do this?
td {border: 1px solid black;}
th {border: 1px solid black;}
<div class="content-container">
<main id="registration">
<div class="form">
<h1>Register For an Account</h1>
<form action="#" method="post">
<table>
<tbody><tr><th><label for="id_username">Username:</label></th><td><input type="text" name="username" required="" id="id_username"></td></tr>
<tr><th><label for="id_first_name">First name:</label></th><td><input type="text" name="first_name" required="" id="id_first_name"></td></tr>
<tr><th><label for="id_last_name">Last name:</label></th><td><input type="text" name="last_name" required="" id="id_last_name"></td></tr>
<tr><th><label for="id_email">Email:</label></th><td><input type="email" name="email" required="" id="id_email"></td></tr>
<tr><th><label for="id_birthdate">Birthdate:</label></th><td><input type="text" name="birthdate" required="" id="id_birthdate"></td></tr>
<tr><th><label for="id_password">Password:</label></th><td><input type="password" name="password" required="" id="id_password"></td></tr>
<tr><th><label for="id_confirm_password">Confirm password:</label></th><td><input type="password" name="confirm_password" required="" id="id_confirm_password"></td></tr>
<tr>
<!-- This is the issue -->
<td align="center" style="border: 1px solid black; width: 100%; text-align: center; margin: auto; display: block; horizontal-align: middle;" colspan=2><input type="submit" value="Register"></td>
</tr>
</tbody></table>
</form>
</div>
</main>
</div>
Add colspan="2" also remove other style
<tr>
<!-- This is the issue -->
<td align="center" colspan="2" style="border: 1px solid black; horizontal-align: middle;" colspan=2><input type="submit" value="Register"></td>
</tr>
td {border: 1px solid black;}
th {border: 1px solid black;}
<div class="content-container">
<main id="registration">
<div class="form">
<h1>Register For an Account</h1>
<form action="#" method="post">
<table>
<tbody><tr><th><label for="id_username">Username:</label></th><td><input type="text" name="username" required="" id="id_username"></td></tr>
<tr><th><label for="id_first_name">First name:</label></th><td><input type="text" name="first_name" required="" id="id_first_name"></td></tr>
<tr><th><label for="id_last_name">Last name:</label></th><td><input type="text" name="last_name" required="" id="id_last_name"></td></tr>
<tr><th><label for="id_email">Email:</label></th><td><input type="email" name="email" required="" id="id_email"></td></tr>
<tr><th><label for="id_birthdate">Birthdate:</label></th><td><input type="text" name="birthdate" required="" id="id_birthdate"></td></tr>
<tr><th><label for="id_password">Password:</label></th><td><input type="password" name="password" required="" id="id_password"></td></tr>
<tr><th><label for="id_confirm_password">Confirm password:</label></th><td><input type="password" name="confirm_password" required="" id="id_confirm_password"></td></tr>
<tr>
<!-- This is the issue -->
<td align="center" colspan="2" style="border: 1px solid black; horizontal-align: middle;" colspan=2><input type="submit" value="Register"></td>
</tr>
</tbody></table>
</form>
</div>
</main>
</div>

Group multiple columns with different size inputs

I have a large number of inputs I need to display. I am trying to condense them into like groups. The first group I am have is going to have 6 inputs in 3 columns but the third input box is big, so I want the next rows input to line up with the bottom of the larger text box. Form Layout
I have tried to float them, list them, use a table, but all without successs
I have looked at a lot of CSS code snippets and cannot figure out how to get this layout. Any help would be greatly appreciated.
Edit: I found a way to make it work, but would like a more elegant solution. HTML:
.row1 {
float: left;
background-color: #ffffff;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
font-family: Raleway, sans-serif;
text-align: center;
text-decoration: none;
padding: 5px;
}
.row2{
float: left;
background-color: #ffffff;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
font-family: Raleway, sans-serif;
text-align: center;
text-decoration: none;
padding: 5px;
}
.row3{
float: left;
display: inline-block;
clear: left;
position: relative;
margin-top: -80px;
}
<div class="row1">
<label>
<span>Full Project Number</span><br>
<input type="text" name="project" id="project">
</label>
</div>
<div class="row1">
<label>
<span>Client</span><br>
<input type="text" name="client" id="client">
</label>
</div>
</div>
<div class="row2 fasttimesatseedmonthigh">
<label id="descrp">
<span>Project Description</span><br>
<textarea name="name" type="text" cols="50" rows="10"></textarea>
</label>
</div>
<div class="row3">
<div class="row1">
<label for="drawing">
<span>Drawing Number</span><br>
<input type="text" name="drawing" id="drawing">
</label>
</div>
<div class="row1">
<label>
<span>Assigned By:</span><br>
<input type="text" name="assigned" id="assigned" style="width: 75px;">
</label>
</div>
<div class="row1">
<label class="form-row">
<span>Date</span><br>
<?php
$stamp=date("Y/m/d");?>
<input type="text" name="date" id="date" value="<?php echo(htmlspecialchars($stamp))?>"/>
</label>
</div>
</div>
It works but like I said not as nice as I would like it.
How about a good ol' table with row&colspan?
.grid{
border: solid 1px black;
table-layout: fixed;
font-family: Raleway, sans-serif;
border-spacing: 10px;
}
.grid td{
text-align: center;
vertical-align: top;
font-size: 9pt;
}
.grid td.wide{
width: 200px;
}
.grid td.normal{
width: 100px;
}
.grid td input{
width: 100%;
}
<table class="grid">
<tr>
<td colspan="2" class="wide">
<label>
<span>Full Project Number</span><br>
<input type="text" name="project" id="project">
</label>
</td>
<td colspan="2" class="wide">
<label>
<span>Client</span><br>
<input type="text" name="client" id="client">
</label>
</td>
<td colspan="2" rowspan="2">
<label id="descrp">
<span>Project Description</span><br>
<textarea name="name" type="text" cols="20" rows="8"></textarea>
</label>
</td>
</tr>
<tr>
<td colspan="1" class="normal">
<label for="drawing">
<span>Drawing Number</span><br>
<input type="text" name="drawing" id="drawing">
</label>
</td>
<td colspan="1" class="normal">
<label>
<span>Assigned By</span><br>
<input type="text" name="assigned" id="assigned">
</label>
</td>
<td colspan="2" class="wide">
<label class="form-row">
<span>Date</span><br>
<input type="text" name="date" id="date">
</label>
</td>
</tr>
</table>
Plis no hate.

HTML: Table design not working properly

I am trying to achieve the below format design in HTML. I tried using multiple TR inside TD but i was not successful in getting the below design.
Please find the below code i have been trying:
#content {
position: absolute;
top: 110px;
left: 350px;
width: 775px;
height: 605px;
}
#content label {
display: block;
float: left;
margin-right: 4px;
vertical-align: top;
}
<div id="content">
<label>
Date Range
</label>
<label>
(Past)
<br />
<input id="myDatePast" type="text" style="width:31px;" />
</label>
<label>
(Future)
<br />
<input id="myDateFuture" type="text" style="width:31px;" />
</label>
<label>
<br />Total
<input id="myDateFuture" type="text" style="width:31px;" />Days
</label>
</div>
Well you can try something like this. I used table and css to style them.
table {
border: 1px solid #666;
border-collapse: collapse;
}
th,tr {width: 150px;}
th input {width: 50px;}
.th1-main {
border-right: 1px solid #666;
}
.th1-modify {margin-left: 60px;}
.th1-modify2 {margin-right: 60px;}
<div id="content">
<table>
<tr>
<th class="th1-main">
<span class="th1-modify">Date</span> <br>
<span class="th1-modify2">Range</span>
</th>
<th>
Past<br>
<input type="text" value="60"><br>
Date
</th>
<th>
Future<br>
<input type="text" value="360"><br>
Date
</th>
<th>
Total - <input type="text" value="420"> days
</th>
</tr>
</table>
</div>
Hope this was helpful.
table,#cell1{
border:2px solid gray;
border-collapse: collapse;
}
#total{
width:auto;height:50px;
}
#cell1{
width:100px;
height:75px;
}
td:not(.empty){
width:100px;
height:50px;
}
<div id="content">
<table>
<tr>
<td id="cell1">
<span style="float:right"><b>Date</b></span><br/><br/>
<span style="float:left"><b>Range</b></span> </td>
<td class="empty"></td>
<td>
(Past)
<br/>
<input id="myDatePast" type="text" value="60" style="width:31px;" /><br/><b>Date</b>
</td>
<td>
(Future)<br/>
<input id="myDateFuture" type="text" value="360" style="width:31px;" /><br/><b>Date</b>
</td>
<td id="total">
Total-
<input id="myDateFuture" type="text" value="420" style="width:31px;"/><b> Days</b>
</td>
</table>
</div>
A good setup would be
<table>
<tr>
<td>2</td><td>2</td>
</tr>
<tr>
<td>3</td><td>4</td>
</tr>
<tr>
<td>5</td><td>6</td>
</tr>
</table>

"Float:right" is not being applied on the submit button

I am trying to float the submit button to the right in the form but I am facing problem the float is not being applied on the submit button Login. I have added some of server-side generated code.
Code
#login-form{
width: 400px;
background-color: #6B0000;
color: white;
}
#loginButton{
color: #6B0000;
border: 1px solid;
padding: 5px 30px 5px 30px;
background-color: white;
border-radius: 3px;
/*This one here does not work */
float: right;
}
<body>
<header id="header">
<h1>
Google Maps & Yahoo Mashup
</h1>
</header>
<DIV id="content">
<form id="login-form" name="login-form" method="post" onSubmit='return false'>
<input type="hidden" name="login-form" value="login-form" />
<table>
<tbody>
<tr>
<td><label>Email</label></td>
<td><input id="login-form:email" type="text" name="login-form:email" /></td>
</tr>
<tr>
<td><label>Password</label></td>
<td><input id="login-form:pwd" type="text" name="login-form:pwd" /></td>
</tr>
<tr>
<td><input type="submit" value="Login" id="loginButton" /></td>
</tr>
</tbody>
</table>
<input type="hidden" name="javax.faces.ViewState" id="j_id1:javax.faces.ViewState:0" />
</form>
</DIV>
</body>
Try this one. I set a colspan of 2 to the input button and gave its parent td a width of 100%, this along with the float right should shift it to the right.
#login-form{
width: 400px;
background-color: #6B0000;
color: white;
}
#loginButton{
color: #6B0000;
border: 1px solid;
padding: 5px 30px 5px 30px;
background-color: white;
border-radius: 3px;
/*This one here does not work */
float: right;
}
/* Make the input's parent td 100%, you may want
a class here instead for browser support */
td:last-child {
width: 100%;
}
<body>
<header id="header">
<h1>
Google Maps & Yahoo Mashup
</h1>
</header>
<DIV id="content">
<form id="login-form" name="login-form" method="post" >
<input type="hidden" name="login-form" value="login-form" />
<table>
<tbody>
<tr>
<td><label>Email</label></td>
<td><input id="login-form:email" type="text" name="login-form:email" /></td>
</tr>
<tr>
<td><label>Password</label></td>
<td><input id="login-form:pwd" type="text" name="login-form:pwd" /></td>
</tr>
<tr>
<!-- setting a colspan of two -->
<td colspan="2"><input type="submit" value="Login" id="loginButton" /></td>
</tr>
</tbody>
</table>
<input type="hidden" name="javax.faces.ViewState" id="j_id1:javax.faces.ViewState:0" />
</form>
</DIV>
</body>

Bootstrap table position adjustment

I have managed to set the width of my table and the margin position to margin-left:-240px;I was supposed to set the table in bootstrap format when i resize my window. However, when I resize my window, the table position seems to be a little off from its position. How can I set the table to margin-left without affecting the bootstrap format?
<div class="container">
<div class="row">
<div class="panel panel-primary filterable">
<div class="panel-heading">
<h3 class="panel-title">Hi there</h3>
</div>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr class="filters">
<th class="col-md-2"><input type="text" class="form-control" placeholder="Type" disabled></th>
<th class="col-md-2"><input type="text" class="form-control" placeholder="Course" disabled></th>
<th class="col-md-2"><input type="text" class="form-control" placeholder="Description" disabled></th>
<th class="col-md-1"><input type="text" class="form-control" placeholder="Credit" disabled></th>
<th class="col-md-2"><input type="text" class="form-control" placeholder="Hourly" disabled></th>
<th class="col-md-2"><input type="text" class="form-control" placeholder="Profile" disabled></th>
<th class="col-md-3"><input type="text" class="form-control" placeholder="Book" disabled></th>
</tr>
</thead>
<tbody>
<tr class="text-nowrap">
<td>3/8/2015</td>
<td>1:15 PM</td>
<td>Field 7</td>
<td>Commingles</td>
<td>Jello Shot Jockeys</td>
<td>Jello Shot Jockeys</td>
<td>Jello Shot Jockeys</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
mystyle.css
.filterable {
margin-top: 30px;
width:140%;
margin-left:-240px;
}
.filterable .panel-heading .pull-right {
margin-top: -90px;
}
.filterable .filters input[disabled] {
background-color: transparent;
border: none;
cursor: auto;
box-shadow: none;
padding: 0;
height: auto;
}
.filterable .filters input[disabled]::-webkit-input-placeholder {
color: black;
}
.filterable .filters input[disabled]::-moz-placeholder {
color: black;
}
.filterable .filters input[disabled]:-ms-input-placeholder {
color: black;
}
<div class="container-fluid">
---- navbar here ----
<div class="row" style="top:100px">
<!-- ----------- left margin ----------------- -->
<div class="col-md-2"></div>
<div class="col-md-10">
--- Your table here ---
</div>
<!-- ----------- right margin ---------------- -->
<div class="col-md-2"></div>
</div>
</div>