Can't center a table in HTML5/CSS3 - html

I'm trying to center the rows in a table element on a page, and they won't center--and I've discovered that for some reason the tbody (and so, the table) width are expanding to the entire width of the page, so margin: 0, auto; will not then center the table.
Instead, the contents of the <tr>s end up all pushed to the left, no matter what I do. The only way I've been able to get the table centered is do something like set the table to width: 10px (obviously smaller than it actually is), but then it also squishes all of its descendants and removes my control over their width, which is not desirable.
How can I get this table centered? Happy to provide more detail as is necessary if the code isn't enough.
PHP/HTML:
<table id="items" class="inventory-table center" border="0" cellpadding="0" cellspacing="0" width="100%">
<?php for($i=0; $i<3; $i++) { ?>
<tr id="inventory-row-<?php echo $i ?>" class="inventory-row">
<td class="inventory-image">
<img src="<my image>" />
</td>
<td class="inventory-name">
Classic frame
</td>
<td class="inventory-price">
$<span class="price">139</span>
</td>
<td class="purchase-number-td">
<span class="purchase-number"></span>
</td>
<td>
<div data-inventoryrownumber="<?php echo $i; ?>" class="arrow-up top-arrow purchase-arrow"></div>
<div data-inventoryrownumber="<?php echo $i; ?>" class="arrow-down bottom-arrow purchase-arrow"></div>
</td>
</tr>
<?php } ?>
</table>
SASS:
/* inventory table css */
$triangle-size: 30px;
.inventory-table {
border-spacing: 10px;
margin: 0 auto;
}
.inventory-row {
display: inline-block;
td {
text-align: center;
}
}
.inventory-image img {
width: 200px;
height: auto;
}
td.purchase-number-td {
min-width: 30px;
}
.arrow-up {
width: 0;
height: 0;
border-left: $triangle-size solid transparent;
border-right: $triangle-size solid transparent;
border-bottom: $triangle-size solid black;
}
.arrow-down {
width: 0;
height: 0;
border-left: $triangle-size solid transparent;
border-right: $triangle-size solid transparent;
border-top: $triangle-size solid black;
}
.top-arrow {
margin-bottom: 30px;
}
.bottom-arrow {
margin-top: 30px;
}
Screenshot from Chrome dev tools:

Well, what about adding a table_conteiner which you do can center?
I've added a div called table_container, and I've centred it using margin: 0 auto;. As the table is inside, is centred in your markup. I've also removed inline-block from the tr, as it made not possible to the td expand to fill all the row. Note that I modified the values of the PHP and SASS from the file to make it pure HTML and CSS, as it's easier to everybody to test a pure markup problem.
/* inventory table css */
.inventory-table {
border-spacing: 10px;
margin: 0 auto;
}
.inventory-row {
/*display: inline-block;*/
}
.inventory-row td {
text-align: center;
}
.inventory-image img {
width: 200px;
height: auto;
}
td.purchase-number-td {
min-width: 30px;
}
.arrow-up {
width: 0;
height: 0;
border-left: 30px solid transparent;
border-right: 30px solid transparent;
border-bottom: 30px solid black;
}
.arrow-down {
width: 0;
height: 0;
border-left: 30px solid transparent;
border-right: 30px solid transparent;
border-top: 30px solid black;
}
.top-arrow {
margin-bottom: 30px;
}
.bottom-arrow {
margin-top: 30px;
}
.table_container {
width: 500px;
}
.table_container {
margin: 0 auto;
border: 1px solid black;
width: 700px
}
</style>
<div class="table_container">
<table id="items" class="inventory-table center" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr id="inventory-row-1" class="inventory-row">
<td class="inventory-image">
<img src="<my image>" />
</td>
<td class="inventory-name">
Classic frame
</td>
<td class="inventory-price">
$<span class="price">139</span>
</td>
<td class="purchase-number-td">
<span class="purchase-number"></span>
</td>
<td>
<div data-inventoryrownumber="1" class="arrow-up top-arrow purchase-arrow"></div>
<div data-inventoryrownumber="1" class="arrow-down bottom-arrow purchase-arrow"></div>
</td>
</tr>
<tr id="inventory-row-1" class="inventory-row">
<td class="inventory-image">
<img src="<my image>" />
</td>
<td class="inventory-name">
Classic frame
</td>
<td class="inventory-price">
$<span class="price">139</span>
</td>
<td class="purchase-number-td">
<span class="purchase-number"></span>
</td>
<td>
<div data-inventoryrownumber="1" class="arrow-up top-arrow purchase-arrow"></div>
<div data-inventoryrownumber="1" class="arrow-down bottom-arrow purchase-arrow"></div>
</td>
</tr>
<tr id="inventory-row-1" class="inventory-row">
<td class="inventory-image">
<img src="<my image>" />
</td>
<td class="inventory-name">
Classic frame
</td>
<td class="inventory-price">
$<span class="price">139</span>
</td>
<td class="purchase-number-td">
<span class="purchase-number"></span>
</td>
<td>
<div data-inventoryrownumber="1" class="arrow-up top-arrow purchase-arrow"></div>
<div data-inventoryrownumber="1" class="arrow-down bottom-arrow purchase-arrow"></div>
</td>
</tr>
</table>
</div>

Adjust the table margin, Add:
margin: 0 auto;

fiddle
HTML
<table>
<th colspan='3'>header</th>
<tr>
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr>
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
</table>
CSS
table {
border: 1px solid red;
width: 100%; /* for small screens */
max-width: 20em; /* define width while keeping it flexible */
margin-right: auto;
margin-left: auto;
}

Related

Replicate Excel custom table using css + html

I want to replicate a table using CSS + HTML
So everything goes well until last part.
Table:
So I try:
#page {
background: #ffffff;
width: 878px;
margin: 0 auto;
margin-top: 40px;
display: block;
border: 1px solid #c4c7c7;
padding: 40px 40px 50px 40px;
position: relative;
z-index: 0;
}
.ship-table {
border-collapse: collapse;
}
.ship-table--title {
border-bottom: 3px solid;
border-top: 3px solid;
text-align: center;
background-color: #d3d3d3;
}
.ship-table--text_center {
text-align: center;
}
.ship-table--divider {
border-right: 3px solid;
border-left: 3px solid;
}
.ship-table--bottom {
border-bottom: 3px solid;
border-right: 3px solid;
}
.ship-table--image {
border-top: 3px solid;
border-right: 3px solid;
}
.ship-table--carrier {
background-color: #339933;
text-align: center;
}
.ship-table--due-box {
border: 3px solid;
}
.ship-table--dueDate {
background-color: #FFFF00;
}
.ship-table--dueDate_value {
font-size: 48px;
}
.ship-table--dueDate_field {
border: 3px solid;
border-color: red;
padding-bottom: 25px;
}
.ship-table--bol_value {
font-size: 28px;
}
<table class="ship-table">
<tbody>
<tr>
<td class="ship-table--title ship-table--divider">SHIP FROM</td>
<td class="ship-table--image" rowspan="2">pic here</td>
</tr>
<tr>
<td class="ship-table--divider">
{{ShipFromCompany}}
<br /> {{ShipFromAddressLineOne}}
<br /> {{ShipFromAddressLineTwo}}, {{ShipFromPostalCode}}
<br /> {{ShipFromAttn}}
<br /> {{ShipFromPhone}}
</td>
</tr>
<tr>
<td class="ship-table--title ship-table--divider">SHIP TO</td>
<td class="ship-table--title ship-table--divider">Carrier Name:</td>
</tr>
<tr>
<td class="ship-table--divider">
{{ShipToCompany}}
<br /> {{ShipToAddressLineOne}}
<br /> {{ShipToAddressLineTwo}}, {{ShipToPostalCode}}
<br /> {{ShipToAttn}}
<br /> {{ShipToPhone}}
</td>
<td class="ship-table--due-box">
<div class="ship-table--carrier ship-table--due-box ship-table--text_center">
{{ShipToCarrier}}
</div>
<div class="ship-table--dueDate ship-table--due-box ship-table--text_center">
DUE DATE:
</div>
<div class="ship-table--dueDate_value ship-table--dueDate_field ship-table--text_center">
{{ShipToDueDate}}
</div>
</td>
</tr>
<tr>
<td class="ship-table--title ship-table--divider">SHIPPER</td>
<td>
<div class="ship-table--title ship-table--divider">
BILL OF LADING NUMBER
</div>
<div class="ship-table--bol_value ship-table--text_center ship-table--divider">
{{BillOfLadingNumber}}
</div>
</td>
</tr>
<tr class="ship-table--bottom">
<td class="ship-table--divider">
{{ShipperCompany}}
<br /> {{ShipperAttn}}
<br /> {{ShipperAddressLineOne}}
<br /> {{ShipperAddressLineTwo}}
</td>
<td></td>
</tr>
</tbody>
</table>
How can I change nested borders to be part of the original colum, date be bigger than and the Bill Of ladding number at the bottom?
For nested borders I use border-colapse: colapse but it does not work.
Here is an easy solution. You can follow it.
#page {
background: #ffffff;
width: 878px;
margin: 0 auto;
margin-top: 40px;
display: block;
border: 1px solid #c4c7c7;
padding: 40px 40px 50px 40px;
position: relative;
z-index: 0;
}
.ship-table {
border-collapse: collapse;
width: 100%;
}
.ship-table tr, .ship-table td{
border: 1px solid #000;
}
.ship-table-table{
width: 100%;
}
.ship-table-table tr, .ship-table-table td{
border:0;
}
.ship-table--title {
border-bottom: 1px solid;
text-align: center;
background-color: #d3d3d3;
}
.ship-table--title-green{
border-top: 1px solid;
border-bottom: 1px solid;
text-align: center;
background-color: #339933;
}
.ship-table--title-yellow{
border-bottom: 1px solid;
text-align: center;
background-color: #FFFF00;
}
.ship-table--title-red{
border: 1px solid red !important;
text-align: center;
padding: 30px 0;
}
.ship-table--dueDate_value {
font-size: 48px;
text-align: center;
}
.ship-table--bol_value {
font-size: 28px;
text-align: center;
}
<div id="page">
<table class="ship-table" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title">
SHIP FROM
</th>
</tr>
<tr>
<td>
{{ShipFromCompany}}
<br /> {{ShipFromAddressLineOne}}
<br /> {{ShipFromAddressLineTwo}}, {{ShipFromPostalCode}}
<br /> {{ShipFromAttn}}
<br /> {{ShipFromPhone}}
</td>
</tr>
</table>
</td>
<td>
pic here
</td>
</tr>
<tr>
<td valign="top">
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title">
SHIP TO
</th>
</tr>
<tr>
<td>
{{ShipToCompany}}
<br /> {{ShipToAddressLineOne}}
<br /> {{ShipToAddressLineTwo}}, {{ShipToPostalCode}}
<br /> {{ShipToAttn}}
<br /> {{ShipToPhone}}
</td>
</tr>
</table>
</td>
<td valign="top" rowspan="2">
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title">
Carrier Name:
</th>
</tr>
<tr>
<td>
CASC
</td>
</tr>
</table>
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title-green">
{{ShipToCarrier}}
</th>
</tr>
<tr>
<th class="ship-table--title-yellow">
DUE DATE:
</th>
</tr>
<tr>
<td class="ship-table--title-red ship-table--dueDate_value">
{{ShipToDueDate}}
</td>
</tr>
</table>
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title">
BILL OF LADING NUMBER
</th>
</tr>
<tr>
<td class="ship-table--bol_value">
{{BillOfLadingNumber}}
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title">
SHIPPER
</th>
</tr>
<tr>
<td>
{{ShipperCompany}}
<br /> {{ShipperAttn}}
<br /> {{ShipperAddressLineOne}}
<br /> {{ShipperAddressLineTwo}}
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
There is no neat way to do this. You have to rely on css hacks to fix the borders. Also I couldn't fix bottom right corner cell
Here's a temporary fix to the nested border issue (except for the last column in the lastrow)
Changes have been highlighted with comments (Also note, I do not recommend this method, I am just giving you an idea of the nested border issue and tricks to overlap them)
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style>
#page {
background: #ffffff;
width: 878px;
margin: 0 auto;
margin-top: 40px;
display: block;
border: 1px solid #c4c7c7;
padding: 40px 40px 50px 40px;
position: relative;
z-index: 0;
}
.ship-table {
border-collapse: collapse;
}
.ship-table--title {
border-bottom: 3px solid;
border-top: 3px solid;
text-align: center;
background-color: #d3d3d3;
}
.ship-table--text_center {
text-align: center;
}
.ship-table--divider {
border-right: 3px solid;
border-left: 3px solid;
}
.ship-table--bottom {
border-bottom: 3px solid;
border-right: 3px solid;
}
.ship-table--image {
border-top: 3px solid;
border-right: 3px solid;
}
.ship-table--carriership-table--carrier {
background-color: #339933;
text-align: center;
}
.ship-table--due-box {
border-right: 3px solid; /*changes */
}
.ship-table--carrier {
border-right:none; /* changes*/
}
.ship-table--dueDate {
background-color: #FFFF00;
border-right: none; /*changes*/
}
.ship-table--dueDate_value {
font-size: 48px;
/*changes*/
position: relative;
margin-left: -4px;
margin-right: -4px;
margin-bottom: -2px;
}
.ship-table--dueDate_field {
border: 3px solid;
border-color: red;
padding-bottom: 25px;
}
.ship-table--bol_value {
font-size: 28px; /*changes*/
border-left: none;
position: relative;
margin-right: -2px;
}
.table-border-fix { /* new class to fix the borders in bottom column*/
border: 3px solid;
position: relative;
margin-left: -4px;
margin-right: -2px;
border-top: none;
}
</style>
</head>
<body>
<table class="ship-table">
<tbody>
<tr>
<td class="ship-table--title ship-table--divider">SHIP FROM</td>
<td class="ship-table--image" rowspan="2">pic here</td>
</tr>
<tr>
<td class="ship-table--divider">
{{ShipFromCompany}}
<br /> {{ShipFromAddressLineOne}}
<br /> {{ShipFromAddressLineTwo}}, {{ShipFromPostalCode}}
<br /> {{ShipFromAttn}}
<br /> {{ShipFromPhone}}
</td>
</tr>
<tr>
<td class="ship-table--title ship-table--divider">SHIP TO</td>
<td class="ship-table--title ship-table--divider">Carrier Name:</td>
</tr>
<tr>
<td class="ship-table--divider">
{{ShipToCompany}}
<br /> {{ShipToAddressLineOne}}
<br /> {{ShipToAddressLineTwo}}, {{ShipToPostalCode}}
<br /> {{ShipToAttn}}
<br /> {{ShipToPhone}}
</td>
<td class="ship-table--due-box">
<div class="ship-table--carrier ship-table--due-box ship-table--text_center">
{{ShipToCarrier}}
</div>
<div class="ship-table--dueDate ship-table--due-box ship-table--text_center">
DUE DATE:
</div>
<div class="ship-table--dueDate_value ship-table--dueDate_field ship-table--text_center">
{{ShipToDueDate}}
</div>
</td>
</tr>
<tr>
<td class="ship-table--title ship-table--divider">SHIPPER</td>
<td>
<!-- introduced new class table-border-fix to below 2 divs-->
<div class="ship-table--title ship-table--divider table-border-fix">
BILL OF LADING NUMBER
</div>
<div class="ship-table--bol_value ship-table--text_center ship-table--divider">
{{BillOfLadingNumber}}
</div>
</td>
</tr>
<tr class="ship-table--bottom">
<td class="ship-table--divider">
{{ShipperCompany}}
<br /> {{ShipperAttn}}
<br /> {{ShipperAddressLineOne}}
<br /> {{ShipperAddressLineTwo}}
</td>
</body>
</html>
References: Nested divs: how can I get overlapping borders?

how to overlap two columns in css

The below picture represents a timeline. Here the task "Exercise" starts from 8:00 to 8:15 and which has been marked with light-blue background color. The other two tasks - first one is "Travel to work" and second one is "Plan day" - are getting overlapped because the former task ("Travel to work") starts from 8:25 to 8:55 and the later task ("Plan day") starts from 8:30 to 9:00. So the overlapping tasks should show as given in the picture.
I tried to implement this using HTML table and css but I am really stuck to move further and its not working the way it is showing in the picture.
<style>
.line{
/* width: 100%; */
border-top: 1px solid black;
/* position: absolute; */
background-color: #ADD8E6;
width: 45%;
height: 30pt;
}
.halfAnHour{
font-size: 11px;
/* text-align: right; */
}
.title{
font-size: 10px;
}
.starttime{
text-align: right;
vertical-align: top;
white-space: nowrap;
}
.time{
border-top: 1px solid black;
width: 10%;
height: 30pt;
}
</style>
<body>
<table style="width: 100%;">
<tr>
<td class="time" style="width: 10%;height: 30pt;">8:00</td>
<td class="line" style="width: 45%;height: 30pt;">Excercise</td>
<td class="line" style="width: 45%;height: 30pt;"> </td>
</tr>
<tr>
<td class="time" style="height: 30pt;">8:30</td>
<td class="line">Travel to work</td>
<td class="line"> </td>
</tr>
<tr>
<td class="time">9:00</td>
<td class="line">Plan day</td>
<td class="line"> </td>
</tr>
<tr>
<td class="time">9:30</td>
<td class="line">Review yesterday's comments</td>
<td class="line"> </td>
</tr>
</table>
</body>
You could use CSS Flexbox and some manipulation of position to overlap tasks occurring in the same hour. This is a good start to achieving a similar layout to the image you provided.
.line{
/* width: 100%; */
border-top: 1px solid black;
/* position: absolute; */
background-color: #ADD8E6;
width: 100%;
height: 30pt;
}
.title{
font-size: 10px;
}
.time{
border-top: 1px solid black;
width: 49px;
width: auto;
height: 30pt;
color: #555;
}
table tr {
display: flex;
align-items: center;
}
table tr td {
flex: initial;
}
table tr td:not(:first-child) {
border-left: .19rem solid blue;
}
table .overlap {
margin-top: .75rem;
}
table .overlap td {
height: 3rem;
margin-bottom: -7px;
}
table .overlap > .time {
padding-right: .6rem;
}
table .overlap .line:last-child {
position: relative;
left: -.5px;
bottom: -2px;
}
.hour {
font-size: 1.3rem;
}
<body>
<table style="width: 100%;">
<tr>
<td class="time hour">8:00</td>
<td class="line">Excercise</td>
</tr>
<tr class="overlap">
<td class="time half">8:30</td>
<td class="line">Plan day</td>
<td class="line" style="margin-bottom: .5rem">Travel to work</td>
</tr>
<tr>
<td class="time hour">9:00</td>
<td class="line">Review yesterday's comments</td>
</tr>
</table>
</body>

html table for a newsletter

I'm trying to reproduce this for a Newsletter, with the text and images centred.
This is what I have so far
I was trying to add the border-collapse: collapse; property and also to add border left and right but I'm stacked. If you have any suggestions how to create the vertical lines and cantered the text and images I would deeply appreciate any help.
<table class="outer-table-2">
<tr>
<td class="three-column">
<div class="section">
<table width="100%">
<tr>
<td class="inner-td">
<table class="content">
<tr>
<td class="text">
<p>01628531300</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div class="section">
<table width="100%">
<tr>
<td class="inner-td">
<table class="content">
<tr>
<td>
<div id="callout">
<ul class="social">
<li><img src="facebook.png"></li>
<li><img src="twitter.png"></li>
<li><img src="linkedin.png"></li>
</ul>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div class="section">
<table width="100%">
<tr>
<td class="inner-td">
<table class="content">
<tr>
<td class="text">
<p>www.cdvi.co.uk<p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<style>
.outer-table-2 {
width: 100%;
max-width: 670px;
margin: 12px auto;
border: 3px solid #00467f;
}
.three-column {
}
.three-column .section {
width: 100%;
max-width: 200px;
display: inline-block;
vertical-align: top;
background-color: #FFFFf;
}
.three-column .social {
width: 100%;
height: 10px;
margin: 0 0 5px 0;
}
.outer-table-2 p {
margin:10px 10px 10px 40px;
color: #00467f;
font-size: 12px;
font-weight: 1000 !important;
line-height: 10px;
}
.middle-table {
margin: auto;
padding-top: 10px;
}
.middle-table img{
width: 120px;
height: 80px;
}
</style>
I think you are massively over-complicating this. You only need one table to recreate a layout similar to your image.
table {
width: 100%;
border-collapse: collapse;
}
tr {
height: 60px;
}
td {
text-align: center;
}
.b-t {
border-top: 5px solid darkblue;
}
.b-l {
border-left: 5px solid darkblue;
}
.b-r {
border-right: 5px solid darkblue;
}
ul {
list-style: none;
margin: 0;
padding: 0;
}
li {
display: inline-block;
}
<table>
<tr>
<td class="b-t b-r">01628531300</td>
<td class="b-t">
<ul class="social">
<li><img src="facebook.png"></li>
<li><img src="twitter.png"></li>
<li><img src="linkedin.png"></li>
</ul>
</td>
<td class="b-t b-l">
www.cdvi.co.uk
</td>
</tr>
</table>

How do I change elements position inside td tag

I have a page which has other sub-tables inside one big table that divides the whole page into 2 parts. My question is how can I change position of all elements inside td tags in order to look it nice? The result I have now is here:
Current result with no position formatting
I want it to look like like this:
The way it's supposed to look
I've tried to do it with CSS formatting using relative position feature like this
.leftSide
{
position: relative;
bottom:250px;
}
And it works so well, but when I zoom in- zoom out this page in the browser it becomes a one big mess(elements by default in the middle of td tag, but then I do it, elements are out of the table). How can I avoid it?
My whole code below:
.splitTable {
width: 100%;
height: 100%;
border: 6px solid #05788D;
border-collapse: collapse;
}
.sides {
border: 6px solid #05788D;
}
.SSRSSObjectCostTableTest {
border: 3px solid #05788D;
border-collapse: collapse;
width: 30%;
}
.sideForSSRSSTables {
border: 3px solid #05788D;
}
.partsTable {
height: 7%;
width: 95%;
border-collapse: collapse;
}
.sideForPartsTable {
border: 3px solid #05788D;
}
.leftSide {
position: relative;
bottom: 250px;
}
.rightSide {
position: relative;
bottom: 250px;
}
<table class="splitTable">
<tr>
<td class="sides">
<div class="leftSide">
<span class="chooseText">Choose</span>
<table class="SSRSSObjectCostTableTest" width="25%">
<tr>
<td class="sideForSSRSSTables">Say this is 1st element</td>
<td class="sideForSSRSSTables">Say this is 2nd element</td>
</tr>
</table>
</div>
</td>
<td class="sides">
<div class="rightSide">
<span class="partsText">Parts</span>
<button type="button" class="addButton">+Add Part</button>
<!--<table class="outerPartTable">-->
<table class="partsTable">
<td class="sideForPartsTable" width="5%">Expand button</td>
<td class="sideForPartsTable">Title + sum1 + sum2</td>
<td class="sideForPartsTable" width="5%">edit</td>
<td class="sideForPartsTable" width="5%">remove</td>
</table>
<!--</table>-->
</div>
</td>
</tr>
</table>
Hope, this helps :)
.splitTable {
width: 100%;
height: 100vh;
border: 6px solid #05788D;
border-collapse: collapse;
}
.sides {
border: 6px solid #05788D;
position: relative;
width: 50%;
}
.sideForSSRSSTables {
border: 3px solid #05788D;
}
.partsTable {
height: 7%;
width: 95%;
margin-top:30px;
border-collapse: collapse;
}
.sideForPartsTable {
border: 3px solid #05788D;
}
.leftSide {
display: flex;
flex-direction:flex-end;
position: absolute;
top: 20px;
width:90%;
left:50%;
transform:translateX(-50%);
}
.leftSide>* {
flex: 1;
}
.SSRSSObjectCostTableTest {
border: 3px solid #05788D;
margin: 5px;
border-collapse: collapse;
}
.rightSide {
position: absolute;
top: 20px;
left:50%;
transform:translateX(-50%);
width:90%;
}
.addButton {
float:right;
margin-right:5%;
}
<table class="splitTable">
<tr>
<td class="sides">
<div class="leftSide">
<span class="chooseText">Choose</span>
<table class="SSRSSObjectCostTableTest">
<tr>
<td class="sideForSSRSSTables">Say this is 1st element</td>
<td class="sideForSSRSSTables">Say this is 2nd element</td>
</tr>
</table>
</div>
</td>
<td class="sides">
<div class="rightSide">
<span class="partsText">Parts</span>
<button type="button" class="addButton">+Add Part</button>
<!--<table class="outerPartTable">-->
<table class="partsTable">
<td class="sideForPartsTable" width="5%">Expand button</td>
<td class="sideForPartsTable">Title + sum1 + sum2</td>
<td class="sideForPartsTable" width="5%">edit</td>
<td class="sideForPartsTable" width="5%">remove</td>
</table>
<!--</table>-->
</div>
</td>
</tr>
</table>

Separator of different sizes

Is it possible to have separator of diferent sizes as the example below
PlunkerDemo
<tr class="foo">
<td>
<div>
<p>
<span class="departureTime">03h00</span>
<span>New-York</span>
</p>
<p class="espacement_important">
<span class="arrivalTime">15h00</span>
<span>Bahamas</span>
</p>
<p class="duration espacement_important"><span >8h00</span>
<span>2 correspond.</span>
<span>A380</span>
</p>
</div>
</td>
<td class="unavailable">indisponible</td>
<td><input type="radio" />
<label >10.00 €</label>
</td>
<td><input type="radio" />
<label >50.00 €</label>
</td>
</tr>
You can do this usign pseudo-elemnts:
First assign name classes to your td elements like long and short:
<td class="long">
<div>
<p>
<span class="departureTime">03h00</span>
<span>New-York</span>
</p>
<p class="espacement_important">
<span class="arrivalTime">15h00</span>
<span>Bahamas</span>
</p>
<p class="duration espacement_important"><span>8h00</span>
<span>2 correspond.</span>
<span>A380</span>
</p>
</div>
</td>
<td class="unavailable">indisponible</td>
<td class="short">
<input type="radio" />
<label>10.00 €</label>
</td>
Then use CSS like this:
.long {
position:relative;
}
.long:after {
content:" ";
height:80%;
border-right:1px solid #eee;
position:Absolute;
right:0;
top:10%;
}
.short {
position:relative;
}
.short:after, .short:before {
content:" ";
height:40%;
border-right:1px solid #eee;
position:Absolute;
right:0;
top:30%;
}
.short:before {
left:0;
right:auto;
}
PlunkerDemo
If you want to avoid the classnames you can use nth-child but only if suits your needs
See the method below and adjust as needed. Will work with a DIV also
table {
border: none;
border-collapse: #EEEEEE;
}
tr {
border: solid 1px #5E6977;
display: block;
margin-bottom: 10px;
min-height: 60px;
width: 500px;
padding: 5px;
}
tr.no-border {
border: none;
border-bottom: solid 1px #5E6977;
}
th {
line-height: 60px;
border: none;
width: 160px;
}
td {
border: none;
width: 160px;
height: 60px;
position: relative;
}
td:last-of-type {
border-right: none;
}
td:nth-of-type(1):after {
content:'';
border-right: solid 1px #5E6977;
position: relative;
width: 160px;
min-height: 30px;
display: table;
background: transparent;
top: 1%;
line-height: 60px;
}
td:nth-of-type(2):after {
content:'';
border-right: solid 1px #5E6977;
line-height: 60px;
position: absolute;
width: 160px;
min-height: 50px;
display: table;
background: transparent;
top: 10%;
}
<table width="200" border="1">
<tbody>
<tr class="no-border">
<th>Month</th>
<th>Savings</th>
<th>Savings</th>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
support cross browser. simplicity new row.
...
<td>
<div style="width:1px;height:91px;background:green;"></div>
</td>
<td class="unavailable">indisponible</td>
<td>
<div style="width:1px;height:91px;background:green;"></div>
</td>
<td>
<input type="radio" />
<label >10.00 €</label>
</td>
...