I have 2 tables beside each other Tested within the element of one bigger table
I have to align the columns elements of these 2 tables to display in a single line . . I havent been able to achieve it with valign or vertical-align . . Please help
<style type="text/css">
.FieldLabel {
padding: 2px;
width: 180px;
}
.Head {
text-align: left;
font-weight: bold;
font-size: 20px;
}
.auto-style1 {
width: 420px;
vertical-align: top;
}
.auto-style2 {
width: 420px;
vertical-align: inherit;
}
</style>
<div id="TXN_SAMPLES_createForm1">
<table>
<tr>
<td colspan="2" class="Head">Request Details
</td>
</tr>
<tr>
<td style="width: 500px">
<table>
<tr>
<td class="FieldLabel">Lead Src Code
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{Lead_Lead_Source_CODE}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Request Date
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{REQUEST_DATE}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Customer
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{CUST_NAME}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Product
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{PROD_NAME}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">DG/Non-DG
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{DG_NONDG}
</div>
</td>
</tr>
</table>
</td>
<td class="auto-style2">
<table>
<tr>
<td class="FieldLabel">.
</td>
<td>
<div class="FieldPlaceholder DataOnly">
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">.
</td>
<td>
<div class="FieldPlaceholder DataOnly">
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Country
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{COUNTRY}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Division
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{DIVISION}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel"></td>
<td>
<div class="FieldPlaceholder DataOnly">
</div>
</td>
</tr>
</table>
</td>
<td style="width: auto">
<table style="float: right">
<tr>
<td class="FieldLabel"></td>
<td>
<div class="FieldPlaceholder DataOnly">
</div>
</td>
</tr>
<tr>
<td class="FieldLabel"></td>
<td>
<div class="FieldPlaceholder DataOnly">
</div>
</td>
</tr>
<tr>
<td class="FieldLabel"></td>
<td>
<div class="FieldPlaceholder DataOnly">
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Quantity (Kg)
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{QTY}
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" class="Head">Sample Details
</td>
</tr>
<tr>
<td style="width: 500px">
<table>
<tr>
<td class="FieldLabel">Dispatch Date
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{DISPATCH_DATE}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Lot No.
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{LOT_NO}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">AWB No.
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{AWB_NO}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Dispatch Mode
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{DISPATCH_MODE}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Freight (THB)
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{FREIGHT}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Additional Cost
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{ADDITIONAL_COST}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Receipt Conformation
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{RECEIPT_CONFORMATION}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Reason for Delay
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{REMARK}
</div>
</td>
</tr>
</table>
</td>
<td class="auto-style1">
<table>
<tr>
<td class="FieldLabel">Shipment Date
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{SHIPMENT_DATE}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Packing
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{PACKING}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Process Time (days)
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{Process_Time}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Courier Service
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{COURIER}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Weight Charged
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{WEIGHT_CHARGEDBY_COURIER}
</div>
</td>
</tr>
<tr>
<td class="FieldLabel">Lead Id
</td>
<td>
<div class="FieldPlaceholder DataOnly">
{Lead_Id}
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
the problem is that your main table width was smaller that the three tables you were putting inside. so the third table with Quantity was getting crammed. i have added border colors to understand the whole thing better.
http://jsfiddle.net/btevfik/Hkcsr/
Avoid using Tables for creating layout. read it here.
Now, if you want to create two columnar layout using divs, containing form elements, see this simple html markup of mine:
create a container CSS class like this:
.table-container
{
margin: 2px;
border: 1px solid #e7e7e7;
background: #fff;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
width: auto;
height: auto;
position: relative;
}
.property-row
{
margin: 5px;
overflow: hidden;
}
.property-name
{
width: 150px;
text-align: right;
padding: 5px;
color: #777777;
vertical-align: middle;
float: left;
}
and use it like this:
<div class="table-container float-left mediumPercentWidth">
<div class="property-row">
<div class="property-name">
<label>Lead Src Code</label>
</div>
<div>
<input type="text" class="mediumPercentWidth" />
</div>
</div>
</div>
I have created a sample here.
In this lookout, how, two divs are placed side by side using css property float:left. How at most places only percentage width is defined, to give it a fluid layout. Take notice of the pattern of the markup.
Related
My code has the following lines:
<div class="verizon-data-duplicate-device-key-89148000004605691537 k-content k-state-active" style="float: left; opacity: 1; display: block;" id="3cf455cc-9777-446b-b733-c60795e419e7-3" role="tabpanel" aria-expanded="true">
<table style="border-collapse: collapse; padding: 3px; border: 1px solid grey;">
<tbody>
<tr>
<td colspan="2">
Verizon Information:
</td>
</tr>
<tr>
<td style="text-align:right;">
Account Name
</td>
<td>
<span>0442047510-00001</span><br>
<span>0442047510-00001</span><br>
</td>
</tr>
<tr>
<td style="text-align:right;">
Billing Cycle End Date
</td>
<td>
<span>2021-07-01T00:00:00</span><br>
<span>2022-01-12T00:00:00</span><br>
</td>
</tr>
<tr>
<td style="text-align:right;">
Carrier Name
</td>
<td>
<span>null</span><br>
<span>null</span><br>
</td>
</tr>
<tr>
<td style="text-align:right;">
Service Plan
</td>
<td>
<span>40515x48526x75802x84777</span><br>
<span>M2MPublicDynamic</span><br>
</td>
</tr>
</tbody>
</table>
</div>
page has many different with different class value keys:
div class="verizon-data-duplicate-device-key-**89148000004605691537** k-content k-state-active"
where 89148000004605691537 is variable
I want to change text color to red for cases, when values inside span for the same td is different.
E.g.:
<td>
<span>2021-07-01T00:00:00</span><br>
<span>2022-01-12T00:00:00</span><br>
</td>
should be red
but
<td>
<span>0442047510-00001</span><br>
<span>0442047510-00001</span><br>
</td>
should not be red.
And compares should be inside only the same td.
Any css classes can be added.
How to implement it?
$("table td").map(function(e) {
if($(this).children("span").length){
if($(this).children("span").contents()[0].textContent != $(this).children("span").contents()[1].textContent){
$(this).addClass("text-danger");
}
}
});
.text-danger {
color: red;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="verizon-data-duplicate-device-key-89148000004605691537 k-content k-state-active" style="float: left; opacity: 1; display: block;" id="3cf455cc-9777-446b-b733-c60795e419e7-3" role="tabpanel" aria-expanded="true">
<table style="border-collapse: collapse; padding: 3px; border: 1px solid grey;" border="1">
<tbody>
<tr>
<td colspan="2">
Verizon Information:
</td>
</tr>
<tr>
<td style="text-align:right;">
Account Name
</td>
<td>
<span>0442047510-00001</span><br>
<span>0442047510-00001</span><br>
</td>
</tr>
<tr>
<td style="text-align:right;">
Billing Cycle End Date
</td>
<td>
<span>2021-07-01T00:00:00</span><br>
<span>2022-01-12T00:00:00</span><br>
</td>
</tr>
<tr>
<td style="text-align:right;">
Carrier Name
</td>
<td>
<span>null</span><br>
<span>null</span><br>
</td>
</tr>
<tr>
<td style="text-align:right;">
Service Plan
</td>
<td>
<span>40515x48526x75802x84777</span><br>
<span>M2MPublicDynamic</span><br>
</td>
</tr>
</tbody>
</table>
</div>
//searches cells containing two spans
//if the two spans don't have the same text content, add the class to
//the spans to color the text red
$('td').each(function(){
const $td = $(this);
const $spans = $td.find('span');
if($spans.length === 2){
if($spans[0].textContent !== $spans[1].textContent){
$spans[0].classList.add('color-red');
$spans[1].classList.add('color-red');
}
}
});
.color-red{
color:red;
}
<div class="verizon-data-duplicate-device-key-89148000004605691537 k-content k-state-active" style="float: left; opacity: 1; display: block;" id="3cf455cc-9777-446b-b733-c60795e419e7-3" role="tabpanel" aria-expanded="true">
<table style="border-collapse: collapse; padding: 3px; border: 1px solid grey;">
<tbody>
<tr>
<td colspan="2">
Verizon Information:
</td>
</tr>
<tr>
<td style="text-align:right;">
Account Name
</td>
<td>
<span>0442047510-00001</span><br>
<span>0442047510-00001</span><br>
</td>
</tr>
<tr>
<td style="text-align:right;">
Billing Cycle End Date
</td>
<td>
<span>2021-07-01T00:00:00</span><br>
<span>2022-01-12T00:00:00</span><br>
</td>
</tr>
<tr>
<td style="text-align:right;">
Carrier Name
</td>
<td>
<span>null</span><br>
<span>null</span><br>
</td>
</tr>
<tr>
<td style="text-align:right;">
Service Plan
</td>
<td>
<span>40515x48526x75802x84777</span><br>
<span>M2MPublicDynamic</span><br>
</td>
</tr>
</tbody>
</table>
</div>
<script
src="https://code.jquery.com/jquery-3.6.0.slim.min.js"
integrity="sha256-u7e5khyithlIdTpu22PHhENmPcRdFiHRjhAuHcs05RI="
crossorigin="anonymous"></script>
There is a huge gap above this table, and I cannot understand why.
Here is the HTML:
.table-size-guide td {
border: 1.5px solid #ced9e0;
padding-left: 10px;
color: #ced9e0;
font-family: helvetica;
font-size: 12px;
}
.sizing-table {
color: #fd8014;
}
<table class="table-size-guide" style="width: 100%;" cellspacing="2" cellpadding="5">
<tbody>
<tr>
<td style="padding-top: 8px; padding-right: 40px; padding-bottom: 5px; padding-left: 12px; background-color: #ededed;">
<span style="color: #ff8f07;"><strong>Waist Size</strong></span>
</td>
<td style="padding-top: 8px; padding-right: 0px; padding-bottom: 5px; padding-left: 12px; background-color: #ededed;">
<span style="color: #ff8f07;"><strong>To fit Height</strong></span>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">26in</div>
</td>
<td>
<div class="sizing-table">128cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">27in</div>
</td>
<td>
<div class="sizing-table">134cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">28in</div>
</td>
<td>
<div class="sizing-table">137cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">29in</div>
</td>
<td>
<div class="sizing-table">140cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">30in</div>
</td>
<td>
<div class="sizing-table">146cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">31in</div>
</td>
<td>
<div class="sizing-table">152cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">32in</div>
</td>
<td>
<div class="sizing-table">152cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">33in</div>
</td>
<td>
<div class="sizing-table">152cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">34in</div>
</td>
<td>
<div class="sizing-table">152cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">35in</div>
</td>
<td>
<div class="sizing-table">158cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">36in</div>
</td>
<td>
<div class="sizing-table">158cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">38in</div>
</td>
<td>
<div class="sizing-table">158cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">40in</div>
</td>
<td>
<div class="sizing-table">158cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">42in</div>
</td>
<td>
<div class="sizing-table">158cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">44in</div>
</td>
<td>
<div class="sizing-table">158cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">46in</div>
</td>
<td>
<div class="sizing-table">158cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">48in</div>
</td>
<td>
<div class="sizing-table">158cm</div>
</td>
</tr>
<tr>
<td>
<div class="sizing-table">50in</div>
</td>
<td>
<div class="sizing-table">158cm</div>
</td>
</tr>
</tbody>
</table>
Ideally, I would like to convert the table to divs but have been unable to find a solution as there are quite a few rows and columns. Any advice?
I feel like this should be easy but I can't get it. I have a left column which can be anywhere from 20 to 2000 pixels tall. I then have a mixture of content: tables, (optionally floating div's), text and images for the rest of the page.
I want multiple rows to wrap as needed next to the side column. Then when the side column is done wrapping will consume the space. I have a sample up on JSFiddle which demonstrates the problem.
I originally thought a flex container with a left floating column would this, however it is not working.
https://jsfiddle.net/heegar/c40wf28c/
CSS
.flexContainer {
display: flex;
width: 740px;
flex-direction: row;
justify-content: space-between;
flex-wrap: wrap;
}
.blue {
background-color: blue;
min-height: 25px;
width: 240px;
}
.green {
background-color: green;
min-height: 40px;
width: 490px;
}
.yellow {
background-color: yellow;
min-height: 90px;
width: 240px;
}
.orange {
background-color: orange;
width: 240px;
min-height: 30px;
}
.red {
background-color: red;
text-align: left;
vertical-align: top;
font-size: .8em;
float: left;
width: 240px;
}
.CadetBlue {
background-color: CadetBlue;
min-height: 40px;
width: 490px;
}
.GoldenRod {
background-color: GoldenRod;
width: 240px;
min-height: 30px;
}
.layoutAuto {
table-layout: auto;
}
.DataTableWithBorder {
width: 100%;
border-collapse: collapse;
border: 1px solid black;
}
.blackback {
background-color: black;
}
HTML
<body style="width:740px;">
<div class="flexContainer">
<div class="red">
<h3 style="color:#FFFFFF; font-size:11px; background-color:#383838; padding-left:8px; margin:10px 0px 1px 0px;">Ocular History</h3>
<span style="font-weight:bold; padding-top:5px;">headaches</span>
<br />
<h3 style="color:#FFFFFF; font-size:11px; background-color:#383838; padding-left:8px; margin:10px 0px 1px 0px;">Ocular Surgical History</h3>
<span style="font-weight:bold; padding-top:5px;">corneal</span>
<br /><span style="font-weight:bold; padding-top:5px;">injection(s) of</span>
<br /><span style="font-weight:bold; padding-top:5px;">lid procedure of·ectropion repair</span>
<br /><span style="font-weight:bold; padding-top:5px;">NLD probing</span>
<br />
<h3 style="color:#FFFFFF; font-size:11px; background-color:#383838; padding-left:8px; margin:10px 0px 1px 0px;">Vitals</h3>
<span style="font-weight:bold; padding-top:5px;">Temp: 98.8 Deg Fer</span>
<br /><span style="font-weight:bold; padding-top:5px;">Pulse: a 101 bpm</span>
<br /><span style="font-weight:bold; padding-top:5px;">Blood Pressure: Sys what? Dia what?</span>
<br /><span style="font-weight:bold; padding-top:5px;">Respiratory Rate: huh? bpm</span>
<br /><span style="font-weight:bold; padding-top:5px;">Weight: 199 Lizards</span>
<br /><span style="font-weight:bold; padding-top:5px;">Height: 515 Red Ants</span>
<br /><span style="font-weight:bold; padding-top:5px;">BMI: 21.18 egg</span>
<br /><span style="font-weight:bold; padding-top:5px;">Blood Glucose Level: bgl 233 vh</span>
<br />
</div>
<div class="green">
Section 1 - should NOT auto fill to bottom of Red column
</div>
<div class="yellow">
Section 2 - should move under section 1 and to the right of the red column
</div>
<div class="orange">
Section 3 - should move next to Section 2
</div>
<div class="blue">
<h3 style="color:#FFFFFF; background-color:#383838; padding-left:8px; margin:10px 0px 0px 0px;">Hertel</h3>
<strong>Base</strong> 91mm
<br /><strong>OD</strong> 18mm <strong>OS</strong> 23mm
</div>
<div class="GoldenRod">
<h3 style="color:#FFFFFF; background-color:#383838; padding-left:8px; margin:10px 0px 0px 0px;">Amsler Grid</h3>
<table>
<tr>
<td class="BoldText top">OS</td>
<td>
<table class="amslerTable layoutFixed">
<tr>
<td class="blackback"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="blackback"> </td>
<td> </td>
<td> </td>
<td> </td>
<td class="blackback"> </td>
<td> </td>
</tr>
<tr>
<td class="blackback"> </td>
<td> </td>
<td> </td>
<td> </td>
<td class="blackback"> </td>
<td> </td>
</tr>
<tr>
<td class="blackback"> </td>
<td> </td>
<td> </td>
<td> </td>
<td class="blackback"> </td>
<td> </td>
</tr>
<tr>
<td class="blackback"> </td>
<td class="blackback"> </td>
<td class="blackback"> </td>
<td class="blackback"> </td>
<td class="blackback"> </td>
<td class="blackback"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td class="blackback"> </td>
<td> </td>
</tr>
</table>
</td>
<td class="BoldText top">OD</td>
<td>
<table class="amslerTable layoutFixed">
<tr>
<td class="blackback"> </td>
<td class="blackback"> </td>
<td class="blackback"> </td>
<td class="blackback"> </td>
<td class="blackback"> </td>
<td class="blackback"> </td>
</tr>
<tr>
<td class="blackback"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td class="blackback"> </td>
</tr>
<tr>
<td class="blackback"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td class="blackback"> </td>
</tr>
<tr>
<td class="blackback"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td class="blackback"> </td>
</tr>
<tr>
<td class="blackback"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td class="blackback"> </td>
</tr>
<tr>
<td class="blackback"> </td>
<td class="blackback"> </td>
<td class="blackback"> </td>
<td class="blackback"> </td>
<td class="blackback"> </td>
<td class="blackback"> </td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div class="green">
sample data
</div>
<div class="orange">
<h3 style="color:#FFFFFF; background-color:#383838; padding-left:8px; margin:10px 0px 0px 0px;">Visual Acuity</h3>
<table class="stripedTable DataTableWithBorder layoutFixed">
<tr class="BoldText">
<td> </td>
<td>CC</td>
<td>SC</td>
<td>PH</td>
</tr>
<tr>
<td class="BoldText">OD</td>
<td>20/25</td>
<td>20/20</td>
<td>20/15</td>
</tr>
<tr>
<td class="BoldText">OS</td>
<td>20/25</td>
<td>20/20</td>
<td>20/15</td>
</tr>
<tr>
<td class="BoldText">OU</td>
<td>20/25</td>
<td>20/20</td>
<td> </td>
</tr>
</table>
<br />Test Used: Sn
</div>
<div class="blue">
blah blah blah
</div>
<div class="CadetBlue">
<h3 style="color:#FFFFFF; background-color:#383838; padding-left:8px; margin:10px 0px 0px 0px;">Auto Refraction</h3>
<strong>Age:</strong> 299 quarter days <strong>Purpose:</strong> justa type
<table class="">
<tr>
<td class="BoldText">OD</td>
<td>-1.50</td>
<td>+0.75</td>
<td>x 11</td>
<td>VaD 20/28/10</td>
<td>VaN 20/2</td>
</tr>
<tr>
<td class="BoldText">OS</td>
<td>-3.00</td>
<td>+1.00</td>
<td>x 154</td>
<td>VaD 20/48/13</td>
<td>VaN 20/2</td>
</tr>
</table>
</div>
</div>
</body>
Here is a piece of code that I have written to put 2 tables inside a bigger table. But i am not able to fix the size of <td> of the outer table. I want to make the <td> of outer table scrollable so that I can scroll the table inside the <td> of the outer table:
Fiddle
Example
<table id="maintable">
<tr>
<td>
<table class="smsSecond">
<tr style="background-color: #3C3C3C;">
<td colspan="2" width="auto" align="center">
Resolution
<!--img id="delete" src="icons/delete.png" height="10" width="10" style="float: right;"/-->
</td>
</tr>
<!--odd row-->
<tr class="oddrow" align="center">
<td>
Harsha P
</td>
<td>
-NA-
</td>
</tr>
</table>
</td>
<td>
<table class="smsSecond"><!--bgcolor="#4ab54d"><class="smsSecond"-- this is td bgcolor: bgcolor="#4ab54d"-->
<tr style="background-color: #3C3C3C;" >
<td colspan="2" width="auto" align="center">
Ticket Info
</td>
</tr>
<!--odd row-->
<tr class="oddrow" align="center"><!-- style="color: #000000; font-size: 12px;"-->
<td>
Ticket number
</td>
<td>
HFK-864-69976
</td>
</tr>
<!--even row-->
<tr class="evenrow" align="center"><!--style="color: #000000; font-size: 15px; background-color: #FFFFFF" --><!--background-color: #A4EAF6-->
<td>
Department
</td>
<td>
Support
</td>
</tr>
<!--odd row-->
<tr class="oddrow" align="center">
<td>
Priority
</td>
<td>
P3-Normal
</td>
</tr>
<!--even row-->
<tr class="evenrow" align="center">
<td>
Open Date and Time
</td>
<td>
2011-02-28 21:24:01
</td>
</tr>
<!--odd row-->
<tr class="oddrow" align="center">
<td>
Close Date and Time
</td>
<td>
2011-02-28 21:24:01
</td>
</tr>
<!--even row-->
<tr class="evenrow" align="center">
<td>
Total Time
</td>
<td>
00:03:09
</td>
</tr>
<!--odd row-->
<tr class="oddrow" align="center">
<td>
Ticket Spent
</td>
<td>
00:02:00
</td>
</tr>
<!--even row-->
<tr class="evenrow" align="center">
<td>
No. of staff worked
</td>
<td>
2
</td>
</tr>
<!--odd row-->
<tr class="oddrow" align="center">
<td>
Ticket Status
</td>
<td>
Closed
</td>
</tr>
<!--even row-->
<tr class="evenrow" align="center">
<td>
SLA
</td>
<td>
Yes
</td>
</tr>
<!--odd row-->
<tr class="oddrow" align="center">
<td>
Type
</td>
<td>
Issue
</td>
</tr>
<!--even row-->
<tr class="evenrow" align="center">
<td>
Red Flag
</td>
<td>
0
</td>
</tr>
<!--odd row-->
<tr class="oddrow" align="center">
<td>
Yellow Flag
</td>
<td>
0
</td>
</tr>
<!--even row-->
<tr class="evenrow" align="center">
<td>
Orange Flag
</td>
<td>
0
</td>
</tr>
<!--odd row-->
<tr class="oddrow" align="center">
<td>
Closed by
</td>
<td>
Harsha p
</td>
</tr>
</table>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
The CSS that I have used so far is:
.smsSecond{
border-radius: 4px;
padding: 8px 8px 8px 8px;
/*max-height: 333px;
overflow: scroll;*/
font-family:Arial;
font-size: 12px;
color: #FFFFFF;
background-color: #CACACA;
border: 1px solid black;
/*background-color: #1AB0EA;*/
}
.smsSecond .oddrow{
color: #000000;
font-size: 12px;
}
.smsSecond .evenrow{
color: #000000;
font-size: 12px;
background-color: #FFFFFF;
}
td{
padding:5px;
font-size: 13px;
width: 290px;
overflow: scroll;
text-overflow: string;
white-space: nowrap;
border: 1px solid black;
}
tr a{
color: #4EB145;
}
tr a:hover{
color: #4EB145;
text-decoration: none;
font-weight: bolder;
}
What should I use for the outer table's field to be of fixed size and scrollable?
What should be the CSS property of #maintable?
Please help.
Thanks in advance.
You can wrap you inner table within a div:
HTML:
<div class="inner_wrapper">
<table ...
CSS:
.inner_wrapper {
overflow:scroll;
height: 110px;
}
Here is the result:
http://jsfiddle.net/Ye2zV/
You can add the whole code of yours inside a div and add to it a height and overflow:auto;
fiddle:
http://jsfiddle.net/2nu5Q/
Hope it helps mate.
Bill.
I am weak in CSS, and I am trying to put a table in my html page, it has two rows and five columns per row(of course it is simplified), and it should look like this (the table is a hand-drawing table, it does not come so precise, I`m sorry for that.):
But mine looks like this:
This is my code:
<table border="1">
<tr>
<td style="width:50px" colspan="2"> </td>
<td style="width:50px" colspan="2"> </td>
<td style="width:50px" colspan="2"> </td>
<td style="width:50px" colspan="2"> </td>
<td style="width:25px"> </td>
</tr>
<tr>
<td style="width:25px"> </td>
<td style="width:50px" colspan="2"> </td>
<td style="width:50px" colspan="2"> </td>
<td style="width:50px" colspan="2"> </td>
<td style="width:50px" colspan="2"> </td>
</tr>
</table>
Code in jsfiddle is here.
NOTE:Any styles could be added, but structure of table could not be changed.
My problem is not the border style of table, but the width of cells, it seems that cells has a erratic width, I hope the right-border of first cell in second row could reach to the middle of bottom-border of first cell in first row, and the right-border of first cell in first row could reach to the middle of top-border of second cell in second row, so is others.
I have tried my best, but it still does not work. How could I do to match the requirement? Any suggestion will be appreciated. Thanks in advance.
You can use a <colgroup> element to achieve this:
<table border="1">
<colgroup>
<col style="width: 25px"/>
<col style="width: 25px"/>
<col style="width: 25px"/>
<col style="width: 25px"/>
<col style="width: 25px"/>
<col style="width: 25px"/>
<col style="width: 25px"/>
<col style="width: 25px"/>
<col style="width: 25px"/>
</colgroup>
<tr>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
</tr>
</table>
It will tell the table that there are 9 columns and each row will span the columns as you originally had.
There are other non-table ways to acheive what you are looking for. Here is one quick example:
<div>
<div class="row">
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
</div>
<div class="row">
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
</div>
</div>
div.row
{
clear:both;
}
div div div
{
width: 50px;
border-width: 1px;
border-style: solid;
border-color: black;
display: inline-block;
float: left;
margin: -1px;
}
div div:nth-child(2n+1) div:first-child,
div div:nth-child(2n) div:last-child
{
width: 25px;
}
Use tables within tables..
<table>
<tr>
<td>
<table border="1">
<tr>
<td style="width:50px"> </td>
<td style="width:50px"> </td>
<td style="width:50px"> </td>
<td style="width:50px"> </td>
<td style="width:25px"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="1">
<tr>
<td style="width:25px"> </td>
<td style="width:50px"> </td>
<td style="width:50px"> </td>
<td style="width:50px"> </td>
<td style="width:50px"> </td>
</tr>
</table>
</td>
</tr>
</table>
This way you will never have that problem...
For this to work, you need to have at least one row that defines the width of individual cells (ones that are not using cellspans):
http://jsfiddle.net/cR2qd/7/1
HTML:
<body>
<table border="1">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
</tr>
</table>
</body>
CSS:
td {
width: 25px;
}