Table inside table without two border space in CSS - css

I want create a table inside a table data. But i am seeing the gap between the outer table and inner table which i dont want. I am not able to attach the image
My Code:
<table class="clearfix sureIQTable scanoTable borderGray TableBottomBorder" id="softTissue">
<tr>
<th nowrap="nowrap" style= "width:1px; background-color: #88A4BB;"></th>
<th nowrap="nowrap" style="width:87px; background-color: #88A4BB;"></th>
<th class="textLeft" style="font-size:12px" colspan="17">
<span class="textLeft"><xsl:value-of select="ScanModeParam/comment"/></span>
</th>
</tr>
<tr>
<th class="textLeft" colspan="3" style="background-color: #88A4BB;vertical-align:top;font-size:15px;font-weight:normal; white-space: nowrap;"><img src="images/GG_Helical.png" alt=""/><br></br>
<td>
<table width="100%">
<tr >
<th class="textCenter width30px" style="font-size:14px;font-weight:bold">Start</th>
<th class="textCenter width100px" style="font-size:14px;font-weight:bold"><xsl:value-of select="ScanModeParam/StartTime/#DisplayName"/></th>
<th class="textCenter width100px" style="font-size:14px;font-weight:bold"><xsl:value-of select="ScanModeParam/WaitTime/#DisplayName"/></th>
<th class="textCenter width100px" style="font-size:14px;font-weight:bold">Start Position(mm)</th>
<th class="textCenter width100px" style="font-size:14px;font-weight:bold"><xsl:value-of select="ScanModeParam/Range/#DisplayName"/></th>
</tr>
</table>
</td>
</tr>
</table>
Could anyone please help me
Thanks

<table width="100%" border="0" cellpadding="0" cellspacing="0">

Can you try it?
To make no space between cells Use border-collapse: collapse;
For CSS
table{
border-collapse: collapse;
border-spacing: 0px; //It is for IE
}

Related

Angular material: table inside mat-expansion not aligned to other table

Im added to Angular website for table ,that table col is not align ,any one know how to do that correctly ?
Thanks
<div class="table-responsive ">
<table class="table" style="width: 100%">
<thead>
<tr>
<th scope="col" width="50">ID</th>
<th scope="col" width="300">Book Name</th>
<th scope="col" width="250">Total Book</th>
<th scope="col" width="250">Date</th>
<th scope="col" width="250">Remarks</th>
<th scope="col" width="250">Booking Date</th>
<th scope="col" width="250">Booking Status</th>
</tr>
</thead>
</table>
</div>
<mat-accordion>
<mat-expansion-panel (opened)="panelOpenState = true; openContent(order)"
(closed)="panelOpenState = false">
<mat-expansion-panel-header [collapsedHeight]="customCollapsedHeight"
[expandedHeight]="customExpandedHeight">
<table class="table ">
<tbody>
<tr>
<td class="tb-td-txt" width="50">12</td>
<td class="tb-td-txt" width="300">ABC</td>
<td class="tb-td-txt" width="250">100}</td>
<td class="tb-td-txt" width="250">10-11-2018</td>
<td class="tb-td-txt" width="250">Jhone Doe</td>
<td class="tb-td-txt" width="250">10-05-2019</td>
<td class="tb-td-txt" width="250">Completed</td>
</tr>
</tbody>
</table>
</mat-expansion-panel-header>
</mat-accordion>
There are a few things...
the lower table is a child of .mat-expansion-panel, so for the table outside it, we mimic the padding:0 24px
but there is also a down arrow for mat-expansion-indicator so we gotta increase the padding on the right side by 8px
next, we text-align center for the bottom table (which is inside the mat-expansion) so that the effect is similar
I have also put a red borders on the <td> so that you can see this
relevant CSS:
th, td{border:1px solid red;}
.table-responsive>.table{padding:0 32px 0 24px;}
mat-expansion-panel-header .table td{text-align: center}
complete working stackblitz here

Display content inline inside to bootstrap table

I have a Bootstrap 4 table that shows monetary value information, but I have a display problem in the responsive mode, then I detail my problem:
I have the following Html code:
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>$ 1,543,3345,432</td>
<td>$ 1,456,334,4545</td>
<td>$ 1,000,0202</td>
</tr>
</tbody>
</table>
</div>
On the PC it is displayed perfectly:
But in response mode the problem appears:
What I want is that in the responsive mode, it looks like the pc. I have tried several ways to change the css to get this, but I could not.
Thank you very much!
You can give width to table and make it inline and another way is applying to white-space: nowrap; of table tr td
.tablewd{
min-width:450px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<div class="table-responsive">
<table class="table table-hover tablewd">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>$ 1,543,3345,432</td>
<td>$ 1,456,334,4545</td>
<td>$ 1,000,0202</td>
</tr>
</tbody>
</table>
</div>
Use Bootstrap-4's text-nowrap class for the table to avoid text break.
/* Source: Bootstrap-4 source code*/
.text-nowrap {
white-space: nowrap !important;
}
https://codepen.io/anon/pen/zLpzwe
You should add more css:
.table td { white-space: nowrap; }

How do I hide a table column in print mode?

How do I hide an entire table column in printing mode (using JS javascript:print())?
Because I'm using Bootstrap I tried its .hidden-print class to hide the last column (Operation column) in printing mode:
<table class="table table-striped">
<thead>
<tr>
<th>No</th>
<th>Name</th>
<th class="hidden-print">Operation</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>John Smith</td>
<td class="hidden-print">
Edit
Delete
</td>
</tr>
<tr>
<td>2</td>
<td>Neo</td>
<td class="hidden-print">
Edit
Delete
</td>
</tr>
<tr>
<-- continued -->
</tr>
</tbody>
</table>
but it's only hide the column's content, displaying a column without content, when I need is it also hides TH and TD tags.
Is it possible to do this?
table,th,td {
border: 1px solid;
text-align: center;
}
table {
border-collapse: collapse;
width: 100%;
}
#media print {
table,th,td {
border: 0px
}
button {
display: none;
}
}
<table class="table table-striped">
<thead>
<tr>
<th>No</th>
<th>Name</th>
<th class="hidden-print">Operation</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>John Smith</td>
<td class="hidden-print">
Edit
Delete
</td>
</tr>
<tr>
<td>2</td>
<td>Neo</td>
<td class="hidden-print">
Edit
Delete
</td>
</tr>
<tr>
</tr>
</tbody>
</table>
<button onclick="window.print();">Print</button>
There are issues with adding display: none; (which is what .hidden-print does) to table rows and cells because removing them from the document flow could very easily mess up the table formatting (see this question).
What about using visibility: hidden; instead?
In your case, you could try this, if you wanted to always target the last column:
#media print {
th:last-child, td:last-child {
visibility: hidden;
}
}

HTML table: remove space between two td tag

How I can remove this space from tag.
<table width="100%">
<thead>
<tr>
<td>Filename</td>
<td colspan="2">DateTime</td>
<td>Size</td>
</tr>
</thead>
<tbody >
<tr>
<td>43343434.jpg</td>
<td>18/02/2015</td>
<td> - 18:32:54</td>
<td>55MB</td>
</tr>
</tbody>
</table>
Image:
So it looks like 18/02/2015 - 18:32:54
I dont want to add time into same tag.
you need to define css:
tbody tr > td:nth-child(2) {
width: 5%;
}
tbody tr > td{
width: 45%;
}
https://jsfiddle.net/yerz2dg2/
Include following property in table tag
cellpadding="0" cellspacing="0"
<table cellpadding="0" cellspacing="0" border="0">
<!-- table elements --!>
</table>
Try this code.
HTML Code
<table border="1" width="100%">
<tr>
<th col width="60">File Name</th>
<th col width="20" colspan="2">Date Time</th>
<th col width="20">Size</th>
</tr>
<tr>
<td col width="60">1.jpg</td>
<td col width="10">18-02-2015</td>
<td col width="10">18:32:54</td>
<td col width="20">55Mb</td>
</tr>
</table>

Aligning html tables to get vertical line same for both

Hello I have these following tables for which I want same vertical line. please check my code here link I have two vertical tables, I want same vertical line of alignment for both the tables so that The line between two tables appears same though the tables are different.
Here is what I want
Here is what I am getting if I add text to th .
please tell me how can I make it better.
table,
th,
td {
border: 1px solid black;
}
<table style="width:100%" cellpadding="10px" cellspacing="1px" padding="20px">
<tr>
<th>Month</th>
<td>Savings</td>
</tr>
<tr>
<th>January</th>
<td>$100</td>
</tr>
<tr>
<th>February</th>
<td>$80</td>
</tr>
</table>
<table style="width:100%">
<tr>
<th>Monthasnsandf</th>
<td>Savings</td>
</tr>
<tr>
<th>Januarydfsadfas</th>
<td>$100</td>
</tr>
<tr>
<th>Februarydfsadfsafa</th>
<td>$80</td>
</tr>
</table>
You could simply specify the width for the th and td elements, say 50%.
table, th, td {
border: 1px solid black;
}
table th, table td {
width: 50%;
}
table th {
text-align: left;
}
<table style="width:100%" cellpadding="10px" cellspacing="1px" padding="20px">
<tr>
<th>Month</th>
<td>Savings</td>
</tr>
<tr>
<th>January</th>
<td >$100</td>
</tr>
<tr>
<th>February</th>
<td >$80</td>
</tr>
</table>
<table style="width:100%" cellpadding="10px" cellspacing="1px" padding="20px">
<tr>
<th>Monthasnsandf</th>
<td>Savings</td>
</tr>
<tr>
<th>Januarydfsadfas</th>
<td >$100</td>
</tr>
<tr>
<th>Februarydfsadfsafa</th>
<td >$80</td>
</tr>
</table>
what I did is put the two tables in another table which has 2 rows to perfectly match vertical alignment
table, th, td {
border: 1px solid black;
}
table th, table td {
width: 50%;
}
<table>
<tr>
<td>
<table style="width:100%">
<tr>
<th>Month</th>
<td>Savings</td>
</tr>
<tr>
<th>January</th>
<td >$100</td>
</tr>
<tr>
<th>February</th>
<td >$80</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table style="width:100%">
<tr>
<th>Monthasnsandf</th>
<td>Savings</td>
</tr>
<tr>
<th>Januarydfsadfas</th>
<td >$100</td>
</tr>
<tr>
<th>Februarydfsadfsafa</th>
<td >$80</td>
</tr>
</table>
</td>
</tr>
</table>
I assume this is what you expect!

Resources