I have one table shown on screen with menu layout.
While menu is not collapsed the table is showing perfectly on screen like the below image.
But once I Collapse the Menu toggle button the table design is getting out of screen like below image. Last 3 columns were out of screen body.
Below is the code for table I am using.
<table width="100%" border="1" cellpadding="1" cellspacing="2" bordercolor="#999999">
<tbody>
<tr>
<td height="24" width="20%">Customer</td>
<td width="15%">Purchase</td>
<td width="15%">Branch</td>
<td width="15%">Status</td>
<td width="15%">PO Issue date</td>
<td width="15%">Delivery Date</td>
<td width="15%">Return Date</td>
<td width="15%">Approved By</td>
<td width="15%">Equipment Recovery</td>
<td width="15%">Labor Recovery</td>
<td width="15%">Shipping Recovery</td>
<td width="15%">Purchase Recovery</td>
<td width="15%">Other Recovery</td>
<td bgcolor="#E6E6E6"><strong>Total</strong></td>
<td>Equipment Rental</td>
<td>Labor</td>
<td>Shipping</td>
<td>Equipment Purchase</td>
<td>Other</td>
<td>Tax</td>
<td>Loss Code</td>
<td nowrap="nowrap" width="100%">Internal Notes</td>
</tr>
<tr>
<td height="24" colspan="13">
<div align="right"><strong>TOTALS</strong></div>
</td>
<td bgcolor="#E6E6E6">$0.00</td>
<td>$0.00</td>
<td>$0.00</td>
<td>$0.00</td>
<td>$0.00</td>
<td>$0.00</td>
<td>$0.00</td>
<td colspan="2"></td>
</tr>
</tbody>
</table>
Can anybody have look and let me know how I can overcome it.
Related
Highlighted cells should be same width
<table class="tg">
<thead>
<tr>
<th class="tg-baqh" colspan="5">Graduate People</th>
<th class="tg-baqh" colspan="4">Uneducated People</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tg-0lax">City</td>
<td class="tg-baqh">Male</td>
<td class="tg-baqh">Female</td>
<td class="tg-baqh">Trangender</td>
<td class="tg-baqh">Total</td>
<td class="tg-baqh">Male</td>
<td class="tg-baqh">Female</td>
<td class="tg-baqh">Trangender</td>
<td class="tg-baqh">Total</td>
</tr>
<tr>
<td class="tg-0lax">Delhi</td>
<td class="tg-baqh">3000</td>
<td class="tg-baqh">3000</td>
<td class="tg-baqh">200</td>
<td class="tg-baqh">6200</td>
<td class="tg-baqh">1000</td>
<td class="tg-baqh">1000</td>
<td class="tg-baqh">100</td>
<td class="tg-baqh">2200</td>
</tr>
<tr>
<td class="tg-0lax">Mumbai</td>
<td class="tg-baqh">4000</td>
<td class="tg-baqh">4000</td>
<td class="tg-baqh">500</td>
<td class="tg-baqh">8500</td>
<td class="tg-baqh">1400</td>
<td class="tg-baqh">600</td>
<td class="tg-baqh">50</td>
<td class="tg-baqh">2050</td>
</tr>
</tbody>
</table>
I used "table-layout: fixed;" but not get the expected output. Cell content should be the same width as per the transgender data cell.
I am creating a table inside another table. I have divided the columns to be the exact same ratio as the outer table. However, the columns are not aligned with outer table columns. Can anyone tell me what I am missing?
<html>
<div style="overflow:scroll;height:140px;width:100%;overflow:auto" style="background-color:black">
<table width="100%" style="padding:0; margin:0;" cellpadding="0">
<tr class="tbl_header" cellpadding="0">
<td width="3%">test1</td>
<td width="7%">test2</td>
<td width="3%">test3</td>
<td width="12%">test4</td>
<td width="7%">test5</td>
<td width="10%"test6</td>
<td width="7%">test7</td>
</tr>
<tr style="background-color:yellow">
<td colspan="7" style="background-color:yellow">
<div style="overflow:scroll;height:110px;width:100%;overflow:auto;border:none;background-color:green">
<table width="100%" style="border:none;background-color:red" cellpadding="0">
<tr class="even">
<td width="3%">2</td>
<td width="7%" class="tdAlign">Testing </td>
<td width="3%" class="tdAlign">Testing </td>
<td width="12%" class="tdAlign">Testing Testing Testing</td>
<td width="7%">Testing_1</td>
<td width="10%">Testing_2</td>
<td width="7%">Testing_3</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</html>
When I inspect the table with chromes web kit. I see that the tables with 3% then they are supposed to be, because of the text length. U can fix this by adding table-layout: fixed to both your <table> elements.
If U want to use a table header I suggest using <th> (see here)
<html>
<div style="overflow:scroll;height:140px;width:100%;overflow:auto" style="background-color:black">
<table width="100%" style="padding:0; margin:0;" cellpadding="0">
<tr class="tbl_header" cellpadding="0">
<td width="3%">test1</td>
<td width="7%">test2</td>
<td width="3%">test3</td>
<td width="12%">test4</td>
<td width="7%">test5</td>
<td width="10%">test6</td>
<td width="7%">test7</td>
</tr>
<tr style="background-color:yellow">
<td colspan="7" style="background-color:yellow">
<div style="overflow:scroll;height:110px;width:100%;overflow:auto;border:none;background-color:green">
<table width="100%" style="border:none;background-color:red" cellpadding="0">
<tr class="even">
<td width="3%">2</td>
<td width="7%" class="tdAlign">Testing </td>
<td width="3%" class="tdAlign">Testing </td>
<td width="12%" class="tdAlign">Testing Testing Testing</td>
<td width="7%">Testing_1</td>
<td width="10%">Testing_2</td>
<td width="7%">Testing_3</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</html>
Looks like you missed a closing tag for a <TD>(<td width="10%">test6</td>). Hope this helps. Let me know
This sounds very similar to previous questions, but I've not found something that matches what I'm trying to do here.
My current code (very verbose with everything in line) looks like this:
td { border: 1px solid black }
<table style="table-layout:fixed">
<tr>
<td>
<table style="table-layout:fixed">
<tr>
<td style="background-color:red"></td>
<td style="background-color:limegreen;width:30px"></td>
<td style="background-color:blue"></td>
<tr>
</table>
</td>
<td>
<table style="table-layout:fixed">
<tr>
<td style="background-color:red"></td>
<td style="background-color:limegreen;width:30px"></td>
<td style="background-color:blue"></td>
<tr>
</table>
</td>
<td>
<table style="table-layout:fixed">
<tr>
<td style="background-color:red"></td>
<td style="background-color:limegreen;width:30px"></td>
<td style="background-color:blue"></td>
<tr>
</table>
</td>
<td>
<table style="table-layout:fixed">
<tr>
<td style="background-color:red"></td>
<td style="background-color:limegreen;width:30px"></td>
<td style="background-color:blue"></td>
<tr>
</table>
</td>
</tr>
<tr>
<td style="width:25%;text-align:center">Some text here</td>
<td style="width:25%;text-align:center">More text</td>
<td style="width:25%;text-align:center">Hi</td>
<td style="width:25%;text-align:center">Somewhat longer text</td>
</tr>
</table>
What I'm trying to accomplish should look like this:
That is, the four main columns should all be the same width, which is the width of the largest content of any of the columns.
The green columns should always be 30px, and the red and blue columns should fill the remaining space each side of that middle column, only up to the width available in the auto-sized outer column.
Setting the internal tables to 100% width makes this happen, but of course the outer table then takes up the entire page width.
I'm also aware that using tables for this is probably not a great idea now we can use CSS, but I'd like to get this example working in tables before 'translating' it.
I'm very opposed to using JavaScript to solve this, for the record!
Edit: I also tried putting all 'subcolumns' in one row, and setting the text to colspan three at a time, with the 25% then applied to that. This ended up confusing the engine, and the width ended up about 75% of the page.
<table style="table-layout:fixed" border="1">
<tr style="font-size: 1px;">
<td width="25%" colspan="3"> </td>
<td width="25%" colspan="3"> </td>
<td width="25%" colspan="3"> </td>
<td width="25%" colspan="3"> </td>
</tr>
<tr style="font-size: 6px;">
<td style="background-color:red"> </td>
<td style="background-color:green"><div style="width: 30px;"> </div></td>
<td style="background-color:blue"> </td>
<td style="background-color:red"> </td>
<td style="background-color:green"><div style="width: 30px;"> </div></td>
<td style="background-color:blue"> </td>
<td style="background-color:red"> </td>
<td style="background-color:green"><div style="width: 30px;"> </div></td>
<td style="background-color:blue"> </td>
<td style="background-color:red"> </td>
<td style="background-color:green"><div style="width: 30px;"> </div></td>
<td style="background-color:blue"> </td>
</tr>
<tr>
<td colspan="3" style="text-align:center">Some text here</td>
<td colspan="3" style="text-align:center">More text</td>
<td colspan="3" style="text-align:center">Hi</td>
<td colspan="3" style="text-align:center">Somewhat longer text</td>
</tr>
</table>
this might solve your answer, your previous code html elements are not properly closed look on that also.
I would like for top 4 elements to stretch across the top, and bottom two to also look like they belong to the same table, stretch and not be so squeezed. Can I accomplish this without adding empty <td>s?
This is how it looks like right now:
http://www.w3schools.com/code/tryit.asp?filename=F0OOEL3HH55Y
My code:
<table cellspacing="2" cellpadding="2" width="650" border="0">
<tr>
<td height="8" class="header" width="300">Weight Per Book (lb.)</td>
<td height="8" class="header" width="300">Cost per Book</td>
<td height="8" class="header" width="200">Quantity for whole order</td>
<td height="8" class="header" width="400">Capability Complexity Level For TO</td>
</tr>
<tr>
<td height="16">2.0</td>
<td height="16">0.00</td>
<td height="16">0</td>
<td height="16">4</td>
</tr>
<tr valign="bottom">
<td class="header">Distribute ID Order to Home Plant</td>
<td class="header">Distribute All OTR's to Home Plant</td>
</tr>
<tr>
<td>No</td>
<td>No</td>
</tr>
</table>
You can use the colspan attribute to do that. This attribute define the number of columns a particular cell should span.
Here is an example:
<table cellspacing="2" cellpadding="2" width="650" border="0">
<tr>
<th colspan="4">Production</th>
</tr>
<tr>
<td height="8" class="header" width="300">Weight Per Book (lb.)</td>
<td height="8" class="header" width="300">Cost per Book</td>
<td height="8" class="header" width="200">Quantity for whole order</td>
<td height="8" class="header" width="400">Capability Complexity Level For TO</td>
</tr>
<tr>
<td height="16">2.0</td>
<td height="16">0.00</td>
<td height="16">0</td>
<td height="16">4</td>
</tr>
<tr valign="bottom">
<td colspan="2" class="header">Distribute ID Order to Home Plant</td>
<td colspan="2" class="header">Distribute All OTR's to Home Plant</td>
</tr>
<tr>
<td colspan="2">No</td>
<td colspan="2">No</td>
</tr>
</table>
Hope this helps!
<html>
<body>
<table align="left" border="0" cellpadding="1" cellspacing="1" style="width: 1000px;">
<tbody>
<tr>
<td width="300">Hanrathsingel 14</td>
<td width="300">Home</td>
<td width="400" height="100%">This one has to take the full height of the table</td>
</tr>
<tr>
<td width="300">1252 AE Laren</td>
<td width="300">Wie zijn wij</td>
</tr>
<tr>
<td width="300">T. 035-6231419</td>
<td width="300">Informatie</td>
</tr>
<tr>
<td width="300">M. 06-21700357</td>
<td width="300">Algemene Voorwaarden</td>
</tr>
<tr>
<td width="300">laren#qualitysites4all.com</td>
<td width="300">Contact</td>
</tr>
</tbody>
</table>
</body>
</html>
How do I get the column to be 100% of the table height but the other columns must keep their height?
Because I want to put a widget in there but I have to work in my boss his cms and I am not allowed to make new divs :(
Try rowspan:
<table align="left" border="0" cellpadding="1" cellspacing="1" style="width: 1000px;">
<tbody>
<tr>
<td width="300">Hanrathsingel 14</td>
<td width="300">Home</td>
<td width="400" rowspan="5">This one has to take the full height of the table</td>
</tr>
<tr>
<td width="300">1252 AE Laren</td>
<td width="300">Wie zijn wij</td>
</tr>
<tr>
<td width="300">T. 035-6231419</td>
<td width="300">Informatie</td>
</tr>
<tr>
<td width="300">M. 06-21700357</td>
<td width="300">Algemene Voorwaarden</td>
</tr>
<tr>
<td width="300">laren#qualitysites4all.com</td>
<td width="300">Contact</td>
</tr>
</tbody>
</table>
Example
JSFiddle Example
Use rowspan="5" in that TD.
Rowspan attribute, tells your element to "get the height" of 5 rows in this case.
If you have dinamic content remember to update this value to the actual number of rows of your table.