HTML: Table design not working properly - html

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>

Related

adjust the textbox size same as table th size equal

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>

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.

"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>

How to have two input fields next to each other in a table cell, each being 50% wide?

I have this table:
<table>
<tr>
<td>
<input type="text" class="half"/>
<input type="text" class="half" />
</td>
<td>
<input type="text"/>
</td>
<td>
<input type="text"/>
</td>
</tr>
</table>
CSS:
table {
width: 100%;
border-spacing: 0;
}
.half {
float: left;
width: 50%;
}
How can I have two input fields next to each other each filling up 50% of the table cell's (natural / normal) width?
Right now, this doesn't work. The table cells containing the input fields of class half are far too wide and I can't see why this happens.
You need two things: DEMO
avoid the white-space in between inline-block element (you may then drop the float property).
include border size into width.
First, the easiest way is to remove white-space from html code and write it so :
<input ... /><input ... />
Second, is to switch to another box-model so :
box-sizing:border-box;
Add vendor-prefix whenever needed .
How about applying .half to the <td> parent?
<td class="half">
<input type="text" />
<input type="text" />
</td>
How about :
<table border="2px">
<tr>
<td>
<input type="text" class= "half"/>
<input type="text" class= "half"/>
</td>
<td>
<input type="text"/>
</td>
<td>
<input type="text"/>
</td>
</tr>
</table>
.css
table {
width: 100%;
border-spacing: 0;
}
td{
padding-left: 5px;
}
.half {
float: left;
width: 49%;
margin: 2px;
}
A quick way to resolve this, wrap then inputs in a span tag. Set the span to inline-block 50%, and the inputs to 100%. Using a box model maintains the inputs in the td
http://jsfiddle.net/HgxFf/
<table>
<tr>
<td>
<span><input type="text" class="half"/></span>
<span><input type="text" class="half" /></span>
</td>
<td>
<input type="text"/><input type="text"/>
</td>
<td>
<span><input type="text"/></span>
</td>
</tr>
</table>
CSS
table {
width: 100%;
border-spacing: 0;
}
td{border:1px solid #000000;font-size:0px; }
span{
display:inline-block;
width:50%;
padding:0px
}
.half {
width: 100%;
}
input[type="text"]{
box-sizing:border-box;
}
}

Making a Form with the Right Alignment and Style

I want to make this form in HTML/CSS:
Unfortunately I can't seem to get the right style and alignment. I've been at it for hours now and whatever avenue I seem to take seems to get me nothing but garbage. Below is my best code, not very good, but it is what it is. Can anybody please help fix the code to reflect the above picture? I would truly appreciate it.
<style> * {
-webkit-box-sizing:border-box;
box-sizing:border-box;
}
.group:after {
content: "";
display: table;
clear: both;
}
.containerANE {
overflow: hidden;
background: #C6DEFF;
width: 992px;
}
.rightANE {
float: right;
width: 30px;
outline: 1px solid #8191a6;
}
.leftANE {
float: left;
width: 152px;
outline: 1px solid #8191a6;
}
.middleANE {
width:717px;
outline: 1px solid #8191a6;
}
</style>
<h1>E-mail US</h1>
<form action="file:///C:/Users/Owner/Desktop/confirmed.php" method="get">
<div class="group containerANE">
<div class="group rightANE">
<img width="25" src="http://i.imgur.com/881g5D7.png">
</div>
<div class="group leftANE">
Name
</div>
<div class="group middleANE">
<input type="text">
</div>
<div class="group rightANE">
<img width="25" src="http://i.imgur.com/881g5D7.png">
</div>
<div class="group leftANE">
Description
</div>
<div class=middleANE>
<textarea rows="4" cols="50">
</textarea>
</div>
<div class=rightANE>
<img width="25" src="http://i.imgur.com/881g5D7.png">
</div>
<div class=leftANE>
E-mail<br><br>Phone
</div>
<div class=middleANE>
<input type="text">
<br> OR <BR>
<input type="text">
</div>
<input type="submit" value="SUBMIT">
This is a representation of the code in JSFiddle.
This FIDDLE will give you a start.
HTML
<table class='holder'>
<tr>
<td>Name:</td>
<td><input type='text' size=40></input></td>
<td><div class='icondiv'></div></td>
</tr>
<tr>
<td>Desscription:</td>
<td><textarea rows=6 cols=31></textarea></td>
<td><div class='icondiv'></div></td>
</tr>
<tr>
<td>Email:</td>
<td><input type='text' size=40></input></td>
<td></td>
</tr>
<tr>
<td colspan='3' id='single'>or<div id='singlediv' class='icondiv'></div></td>
</tr>
<tr>
<td>Phone:</td>
<td><input type='text' size=40></input></td>
<td></td>
</tr>
<tr>
<td colspan='3' id='single'><input type='submit'></input></td>
</tr>
</table>
The CSS is a bit long, and it's in the fiddle in any case.
Play with the CSS to refine it to your needs.