Content in absolute positioned div is overflowing - html

I have a weird question, and perhaps it's more suitable for the CSS fans out there, but why would content inside an absolute positioned div overflow out past everything else?
The example provided here (as a picture) shows that the content overflows out the blue bordered div. The content inside this box should rightfully define the the div's height no? How can this be remedied so that my 'blue' box fits to its content?
Here's the markup in question:
* {
box-sizing: border-box;
font-family: Verdana, Arial, sans-serif;
font-size: 9pt;
}
html {
height: 100%;
}
body {
margin: 0;
padding: 0;
height: 100%;
background: rgb(105, 105, 105);
}
#table-container {
display: table;
text-align: center;
width: 100%;
height: 100%;
}
#container {
display: table-cell;
vertical-align: middle;
}
#wrapper {
padding: 25px;
}
.tabs {
position: relative;
margin: 40px 0 25px;
}
.tab {
float: left;
}
.tab label {
background: rgb(105, 105, 105);
padding: 10px;
border: 1px solid transparent;
color: #FFF;
margin-left: -1px;
position: relative;
left: 1px;
top: -26px;
}
.tab label:hover {
background: #000;
}
.tab [type=radio] {
display: none;
}
.content {
position: absolute;
top: -1px;
left: 0;
background: rgb(222, 222, 222);
right: 0;
bottom: 0;
padding: 20px;
border: 1px solid transparent;
opacity: 0;
color: rgb(58, 58, 58);
}
[type=radio]:checked~label {
background: rgb(222, 222, 222);
font-weight: bold;
border-bottom: 1px solid transparent;
color: #000;
z-index: 2;
}
[type=radio]:checked~label~.content {
z-index: 1;
opacity: 1;
}
/* CSS for Table and Field styling */
.table {
width: 100%;
padding: 0;
margin: 0;
text-align: left;
}
.table td {
border: 1px solid #000;
}
.inputbox {
border: 1px solid rgb(170, 170, 170);
width: 100%;
}
.inputbox:hover {
border: 1px solid rgb(109, 109, 109);
}
.input {
border-style: none;
border-color: inherit;
border-width: 0;
padding: 3px;
height: 20px;
}
input[type="text"],
textarea {
width: 100%;
box-sizing: border-box;
}
.input:focus {
background: rgb(255, 255, 196);
}
<div id="table-container">
<div id="container">
<div id="wrapper">
<div style="border: 1px solid red; text-align: left; font-size: 8pt; color: #fff;">Choose language/Choisissez langue:</div>
<div style="border: 1px solid blue; height: 100%;">
<div class="tabs">
<!-- TAB [1] -->
<div class="tab">
<input type="radio" id="tab-1" name="tab-group-1" checked><label for="tab-1">English</label>
<div class="content">
<table class="table">
<tr>
<td>Traveller's Name:</td>
<td colspan="2">
<div class="inputbox"><input type="text" id="tname" class="input" name="Name of Traveler" tabindex="1" /></div>
</td>
<td style="width: 15%;"></td>
<td>Tan #:</td>
<td></td>
</tr>
<tr>
<td>Destination:</td>
<td colspan="2">
<div class="inputbox"><input type="text" id="location" class="input" name="Location" tabindex="2" /></div>
</td>
<td></td>
<td>Status:</td>
<td></td>
</tr>
<tr>
<td>iTravel Trip Number:</td>
<td colspan="2">
<div class="inputbox"><input type="text" id="location" class="input" name="Location" tabindex="2" /></div>
</td>
<td></td>
<td>Date Issued:</td>
<td>
<div class="inputbox"><input type="text" id="dissued" class="input" disabled/></div>
</td>
</tr>
<tr>
<td>Event Plan ID Code:</td>
<td colspan="2">
<div class="inputbox"><input type="text" id="evt-plan-code" class="input" name="Event Plan ID Code" tabindex="4" /></div>
</td>
<td></td>
<td>Issued by:</td>
<td>
<div class="inputbox"><input type="text" id="issuer" class="input" disabled/></div>
</td>
</tr>
<tr>
<td>Dates of Travel</td>
<td>From:</td>
<td>
<div id="ddate" name="Departure Date" tabindex="5"></div>
</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td> </td>
<td>To:</td>
<td>
<div id="rdate" name="Return Date" tabindex="6"></div>
</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Trip Purpose</td>
<td colspan="3"></td>
<td></td>
<td></td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</div>
</div>
<div class="tab">
<input type="radio" id="tab-2" name="tab-group-1"><label for="tab-2">Français</label>
<div class="content">
tab2
</div>
</div>
</div>
</div>
<div style="border: 1px solid green; text-align: left;">
<input type="button" value="Issue TAN" id="issue">
<input type="button" value="Reset form" id="issue">
<input type="button" value="Save changes" id="issue">
</div>
</div>
<!-- end of div #wrapper -->
</div>
<!-- end of div #container -->
</div>
<!-- end of div #table-container -->

The absolute-positioned div doesn't affect the container div's size since setting position to absolute removes it from the document flow. It's essentially the same behaviour as when position is set to fixed, except it stays at the same place in the page when you scroll. More info can be found here and here.
As for how to fix the height of your div, the short answer is that it can't be done with CSS unless you use a different value for position, perhaps relative in your case but that will depend on the structure of your html. This question covers some other ways that you could go about it.

Related

Html formet is not behaving proper while sending it as a mail using java mail api, SMTP Protocal

I am using JavaMail API for sending mail. In my mail, I have to attach HTML content.
I am using the following code to prepare HTML.
<html>
<head>
<style>
input[type=text],
select,
textarea {
padding: 12px 30px;
margin: px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
background-color: white;
color: black;
font-size: 75%;
}
input[type=text],
select .longText {
width: 100%;
}
textarea.longText {}
.processDetails {
background-color: #f2f2f2;
width: 80%;
}
div {
border-radius: 5px;
padding: 20px;
}
textarea#description {
margin-left: 4%;
}
.center {
margin: auto;
width: 50%;
box-sizing: border-box;
border-radius: 4px;
padding: 0;
text-align: center;
margin-top: 6px;
}
label {
margin-left: 5%;
color: blue
}
#centerBody {
margin: auto;
width: 100%;
box-sizing: border-box;
border-radius: 4px;
padding: 0;
text-align: center;
margin-top: 6px;
}
</style>
</head>
<body>
<div class="processDetails">
<div class="center">
<table>
<tr>
<td width="40%">
<label for="process"> Name</label>
</td>
<td width="60%">
<input type="text" class="longText" value=DSDS disabled>
</td>
</tr>
</table>
</div>
<div class="centerBody">
<table id="processTable">
<tr>
<td width="20%">
<label for="processProperties">Code</label>
</td>
<td width="28%">
<input type="text" value=TAWELC disabled>
</td>
<td width="20%">
<label for="processProperties">City</label>
</td>
<td width="28%">
<input type="text" value=Lucknow disabled>
</td>
</tr>
<tr>
<td width="20%">
<label for="processProperties">Organisation</label>
</td>
<td width="28%">
<input type="text" value=HR disabled>
</td>
<td width="20%">
<label for="processProperties">Email</label>
</td>
<td width="28%">
<input type="text" value=vishal.something#gmail.com disabled>
</td>
</tr>
</table>
<table>
<tr>
<td width="19%">
<label for="description">Adress</label>
</td>
<td width=68%>
<textarea class="longText" cols=65% style="height:50px;margin-left: 5%;resize: none; position: fixed;" disabled>asd</textarea>
</td>
<td width=24%></td>
</tr>
</table>
</div>
</div>
</body>
</html>
When I sent this as a mail body, I found that the behavior of the HTML content is not the same in Browser and Outlook Applications.
I can see text area alignment differences when I open mail in the Microsoft outlook application.
Please let me know what is wrong here or how can I fix the issue.
Regards,
Vishal

CSS Border doubling with flex

I have a piece of CSS I am working with. Whenever I add the "display: flex" property to .student, the border suddenly doubles. I need the flex property because I want the text to be centered vertically next to the image inside of the .student table data cell. How can I get rid of this pesky double border? The double border goes away whenever I remove the display:flex property, but then the text is no longer vertically next to the image. I've tried whitespace, border collapse, and several others without any luck.
Codepin: https://codepen.io/dansbyt/pen/dyvoejG?editors=1100
CSS:
/* ------------{GRADEBOOK}------------ */
.gradebook {
position: absolute;
top: 60px; left: 0;
width: 100vw; height: calc(100vh - 126px);
overflow-y: scroll;
box-sizing: border-box;}
/* Table styling*/
table {table-layout: fixed; border-collapse: collapse;}
/* Table heading styling */
thead th {
height: 60px; width: 100px;
top: 0; z-index: 2;
position: -webkit-sticky; position: sticky;
border-right: 1px solid gray;
background-color: white;}
thead th:first-child {left: 0; z-index: 10;}
th {
padding: 10px 16px;
text-align: left;
font-weight: normal;
color: gray}
table .duedate {font-size: 14px; margin-bottom: 8px}
table .title {font-size: 18px; color: #5B7042}
/* Table data styling */
td {
text-align: center;
border: 1px solid gray;
background-color: white}
td.late{background-color: #EA5D6B}
td input {
text-align: center;
padding: 4px; margin: 0;
width: 114px;
border: none;}
/* Student Name styling */
.student {
padding: 6px;
box-sizing: border-box;
display: flex;
align-items: center}
.pic{
display: inline-block;
width: 25px;
clip-path: circle();
margin-right: 10px;}
.pic img{display: none}
/* ------------{CONTROLS}------------ */
.controls {
display: flex;
position: absolute;
bottom: 10px; left: 0;
width: 100vw; height: 56px;
border-top: 1px solid #DDDDDD}
HTML:
<link rel="stylesheet" href="../style.css">
<div class='gradebook'>
<table>
<thead>
<tr>
<th style='width: 200px'></th>
<th>
<div class='duedate'>Due Oct 08</div>
<div class='title'>Mayflower Vocabulary</div>
</th>
<th>
<div class='duedate'>Due Oct 15</div>
<div class='title'>Wax Museum</div>
</th>
<th>
<div class='duedate'>Due Oct 15</div>
<div class='title'>American Revolution</div>
</th>
<th>
<div class='duedate'>Due Oct 27</div>
<div class='title'>Jamestown</div>
</th>
<th>
<div class='duedate'>Due Nov 1</div>
<div class='title'>Comparing Colonies</div>
</th>
</tr>
</thead>
<tr>
<td class='student'>
<img class='pic' src='../pics/default.png'>
<span>Jane Doe</span>
</td>
<td><input type='text' value='-'></td>
<td class='late'><input type='text' value='10'></td>
<td><input type='text' value='9.5'></td>
<td><input type='text' value='10'></td>
<td><input type='text' value='5'></td>
</tr>
<tr>
<td class='student'>
<img class='pic' src='../pics/default.png'>
<span>John Doe</span>
</td>
<td><input type='text' value='-'></td>
<td><input type='text' value='8'></td>
<td><input type='text' value='9'></td>
<td><input type='text' value='10'></td>
<td class='late'><input type='text' value='9'></td>
</tr>
</table>
</div>
<div class='controls'>
</div>
Image of issue:
Instead of using border: 1px solid gray you can try this.
td {
text-align: center;
border: 1px solid gray;
border-bottom: 0;
border-right: 0;
background-color: white
}
tr:last-of-type td {
border-bottom: 1px solid gray;
}
td:last-of-type {
border-right: 1px solid gray;
}
/* ------------{GRADEBOOK}------------ */
.gradebook {
position: absolute;
top: 60px;
left: 0;
width: 100vw;
height: calc(100vh - 126px);
overflow-y: scroll;
box-sizing: border-box;
}
/* Table styling*/
table {
table-layout: fixed;
border-collapse: collapse;
}
/* Table heading styling */
thead th {
height: 60px;
width: 100px;
top: 0;
z-index: 2;
position: -webkit-sticky;
position: sticky;
border-right: 1px solid gray;
background-color: white;
}
thead th:first-child {
left: 0;
z-index: 10;
}
th {
padding: 10px 16px;
text-align: left;
font-weight: normal;
color: gray
}
table .duedate {
font-size: 14px;
margin-bottom: 8px
}
table .title {
font-size: 18px;
color: #5B7042
}
/* Table data styling */
td {
text-align: center;
border: 1px solid gray;
border-bottom: 0;
border-right: 0;
background-color: white
}
tr:last-of-type td {
border-bottom: 1px solid gray;
}
td:last-of-type {
border-right: 1px solid gray;
}
td.late {
background-color: #EA5D6B
}
td input {
text-align: center;
padding: 4px;
margin: 0;
width: 114px;
border: none;
}
/* Student Name styling */
.student {
padding: 6px;
box-sizing: border-box;
display: flex;
align-items: center;
margin-bottom: -1px;
}
.pic {
display: inline-block;
width: 25px;
clip-path: circle();
margin-right: 10px;
}
.pic img {
display: none
}
/* ------------{CONTROLS}------------ */
.controls {
display: flex;
position: absolute;
bottom: 10px;
left: 0;
width: 100vw;
height: 56px;
border-top: 1px solid #DDDDDD
}
<link rel="stylesheet" href="../style.css">
<div class='gradebook'>
<table>
<thead>
<tr>
<th style='width: 200px'></th>
<th>
<div class='duedate'>Due Oct 08</div>
<div class='title'>Mayflower Vocabulary</div>
</th>
<th>
<div class='duedate'>Due Oct 15</div>
<div class='title'>Wax Museum</div>
</th>
<th>
<div class='duedate'>Due Oct 15</div>
<div class='title'>American Revolution</div>
</th>
<th>
<div class='duedate'>Due Oct 27</div>
<div class='title'>Jamestown</div>
</th>
<th>
<div class='duedate'>Due Nov 1</div>
<div class='title'>Comparing Colonies</div>
</th>
</tr>
</thead>
<tr>
<td class='student'>
<img class='pic' src='../pics/default.png'>
<span>Jane Doe</span>
</td>
<td><input type='text' value='-'></td>
<td class='late'><input type='text' value='10'></td>
<td><input type='text' value='9.5'></td>
<td><input type='text' value='10'></td>
<td><input type='text' value='5'></td>
</tr>
<tr>
<td class='student'>
<img class='pic' src='../pics/default.png'>
<span>John Doe</span>
</td>
<td><input type='text' value='-'></td>
<td><input type='text' value='8'></td>
<td><input type='text' value='9'></td>
<td><input type='text' value='10'></td>
<td class='late'><input type='text' value='9'></td>
</tr>
</table>
</div>
<div class='controls'>
</div>
My assumption is that problem arises from clashing between two layout alghorithms, table and flex one. Td belongs to table one and putting flex there just make problems.
So only solution is to wrap td content with div, and put flex onto that div.
table{
border-collapse: collapse;
}
td{
border: 1px solid;
}
.flex{
display: flex;
}
<!DOCTYPE html>
<html lang="en">
<body>
<table>
<th>flex</th>
<th>flex</th>
<tr>
<td class='flex'>...</td>
<td>...</td>
</tr>
<tr>
<td>...</td>
<td class='flex'>...</td>
</tr>
</table>
<table>
<th>div flex</th>
<th>div flex</th>
<tr>
<td> <div class='flex'>...</div></td>
<td> <div class='flex'>...</div></td>
</tr>
<tr>
<td> <div class='flex'>...</div></td>
<td> <div class='flex'>...</div></td>
</tr>
</table>
</body>
</html>

scrollbars are hidden and the page content is not completely shown

Im facing two problems which are related with each other as i can assume. My webpage is not being fully displayed, a lot of content is hidden down and the scrollbar at the right side and the vertical one are not shown. I have tried to solve that with the overflow property in the body, the scrollbar was there but invisible so it didnt help me a lot. I want the content to be visible even though im zooming in(200% or whatever)
here is a snippet of my code
<nav class="sideBar">
<div class="sideBarHeader" id="wrapper">
<div class="dropdown">
</div>
<div class="ono">
<p style="font-size: 48px;">XXX</p>
</div>
</div>
<div style="padding-left: 2px;">
<div class="searchContainer">
</div>
</div>
</nav>
<div class="mainContentClient">
<div class="clientHeader">
</div>
<div class="clientContent"> <!-- the client content class is not defined yet -->
<table class="onoTable paddedManagementTableContent thUpperCase">
<tr>
<th style="height: 40px;"></th>
</tr>
<tr style="background-color: #DEDEDE; height: 100px;">
<td style="border-bottom: 0;">STATS</td>
</tr>
</table>
<div style="height: 100%;" id="wrapper"> <!-- subcontent -->
<!-- left tables -->
<div class="leftClientContent">
<table class="onoTable paddedManagementTableContent thUpperCase">
<tr>
<th style="height: 40px;">
<a href="vehicle/">
</a>
</th>
</tr>
<tr>
<td style="border-bottom: 0;"></td>
</tr>
</table>
<table class="onoTable paddedManagementTableContent thUpperCase">
<tr>
<th style="height: 40px;">
<a href="cargounit/">
</a>
</th>
</tr>
<tr>
<td style="border-bottom: 0;"></td>
</tr>
</table>
</div>
<!-- right table + Map -->
<div class="rightClientContent">
<table class="onoTable paddedManagementTableContent thUpperCase">
<tr>
<th style="height: 40px;" colspan="2">
info
</th>
</tr>
<tr>
<td style="border-bottom: 0; width: 10%;"></td>
<td style="border-bottom: 0; width: 90%;"><input type="text" placeholder="" name=""></td>
</tr>
<tr>
<td style="border-bottom: 0; width: 10%;"></td>
<td style="border-bottom: 0; width: 90%;"><input type="text" placeholder="" name=""></td>
</tr>
<tr>
<td style="border-bottom: 0; width: 10%;"></td>
<td style="border-bottom: 0; width: 90%;"><input type="text" placeholder="" name=""></td>
</tr>
<tr>
<td style="border-bottom: 0; width: 10%;"></td>
<td style="border-bottom: 0; width: 90%;"><input type="text" placeholder="" name=""></td>
</tr>
<tr>
<td style="border-bottom: 0; width: 10%;"></td>
<td style="border-bottom: 0; width: 90%;"><input type="text" placeholder="" name=""></td>
</tr>
<tr>
<td style="border-bottom: 0; width: 10%;"></td>
<td style="border-bottom: 0; width: 90%;"><input type="text" placeholder="" name=""></td>
</tr>
<tr>
<td style="border-bottom: 0; width: 10%;"></td>
<td style="border-bottom: 0; width: 90%;"><input type="text" placeholder="" name=""></td>
</tr>
</table>
<table class="onoTable paddedManagementTableContent thUpperCase">
<tr>
<th style="height: 40px;">
</th>
</tr>
<tr>
<td style="border-bottom: 0;"> <!-- map properties -->
<div id="Map" class="mapStyling"></div>
<script>
var lat = 47.35387;
var lon = 8.43609;
var zoom = 18;
var fromProjection = new OpenLayers.Projection("EPSG:4326");
var toProjection = new OpenLayers.Projection("EPSG:900913");
var position = new OpenLayers.LonLat(lon, lat).transform( fromProjection, toProjection);
map = new OpenLayers.Map("Map");
var mapnik = new OpenLayers.Layer.OSM();
map.addLayer(mapnik);
var markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers);
markers.addMarker(new OpenLayers.Marker(position));
map.setCenter(position, zoom);
</script>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
and the css :
.sideBar {
height: 100%;
width: 17%;
position: fixed;
top: 0;
left: 0;
background-color: #C0C0C0;
max-width: 250px;
min-width: 250px;
overflow: auto;
}
.sideBarHeader {
padding: 4% 8%;
padding-left: 10%;
height: 85px;
}
.clientHeader {
font-size: 48px;
height: 130px;
}
.mainContentClient {
position: fixed;
top: 0;
height: 100%;
width: 77%;
margin: 0 280px;
}
.ono {
width: 180px;
text-align: right;
/* keep the ono aligned, use a negativ margin*/
margin-top: -28%;
}
.clientContent {
height: 100%;
width: 1130px;
max-width: 1500px;
min-width: 1000px;
}
.leftClientContent {
width: calc(100% - 850px);
margin-top: 2%;
}
.rightClientContent {
width: 850px;
margin-top: 2%;
margin-left: 10px;
}
.mapStyling {
width: 102.5%;
height: 300px;
margin-left: -20px;
}
/* default settings for the tables in part management*/
table.onoTable{
width: 100%;
border-collapse: collapse;
box-sizing: border-box;
table-layout: fixed;
}
table.onoTable th {
background-color: #FBD85C;
border-width: 0 10px;
border-color: #f1f1f1;
border-style: solid;
height: 62.5px;
font-size: 24px;
}
table.onoTable th:first-child {
border-left: 0;
}
table.onoTable th:last-child {
border-right: 0;
}
table.onoTable td {
border-width: 0 10px 4px 10px;
border-color: black #f1f1f1;
border-style: solid;
height: 50px;
font-size: 24px;
}
table.onoTable td:first-child {
border-left: 0;
}
table.onoTable td:last-child {
border-right: 0;
}
/**/
table.noBorder_1_2 td:nth-child(1) {
border-right: 0;
}
table.noBorder_1_2 td:nth-child(2) {
border-left: 0;
}
table.centerContent_24 th, table.centerContent_24 td {
text-align: center;
font-size: 24px;
}
tr.borderBottom_0 > td {
border-bottom: 0;
}
.backgroundColor_grey {
background-color: #DEDEDE;
}
/* shift the content of the main table of the management table a little bit to the right side*/
table.paddedManagementTableContent td {
text-align: left;
padding-left: 20px;
}
table.paddedManagementTableContent th {
text-align: left;
padding-left: 30px;
width:30%;
}
table.paddedManagementTableContent th:first-child {
text-align: left;
padding-left: 20px;
}
here is a live demo
https://jsfiddle.net/edwjvmsc/
thanks everyone!
Well, I'm not sure if this would be correct answer. but I removed the 'position:fixed' property from 'mainContentClient' class and the scrollbar is showing and you can scroll your content. Try it and let me know if it helped :).
.mainContentClient {
top: 0;
height: 100%;
width: 77%;
margin: 0 280px;
}

How to horizontally align div element to another div?

I create the following HTML page and I would align the two DIV elements (the ones with lista and scheda id, contained within parent div) to the same position, at the top of the page. Here is my code:
#tabella1,
#tabella1 td {
border: solid 1px;
}
th {
border: solid 1px;
font-style: bold;
background-color: white;
}
#tabella1 tr:nth-child(odd) {
background-color: gray;
}
#tabella1 tr:nth-child(even) {
background-color: lightgray;
}
#tabella1 tr:nth-child(n):not(:nth-child(1)):hover {
background-color: blue;
color: yellow;
cursor: pointer;
}
.titolo {
text-align: center;
font-weight: bold;
}
#lista {
display: inline-block;
margin: 30px;
position: relative;
top: 0px;
}
button {
width: 60px;
height: 20px;
}
form {
display: inline-block;
}
#msg {
font-weight: bold;
}
#scheda {
display: inline-block;
position: relative;
top: 0px;
text-align: center;
}
#tabella2 td:nth-child(even) {
border: solid 1px;
}
.cellaVuota {
width: 140px;
}
<div id="carica">
<form method="post" action="carica2.php">
<label for "n">Inserisci nome:
<input type="text" id="n" name="nome" size="10" />
</label>
<button type="submit">Invia</button>
</form>
<form method="post" action="carica2.php">
<button type="submit" name="logout">Logout</button>
</form>
</div>
<div id="parent">
<div id="lista">
<table id="tabella1">
<tr>
<th>Modello</th>
<th>27.5</th>
<th>29</th>
</tr>
<tr>
<td>Riga 1</td>
<td>Riga 2</td>
<td>Riga 3</td>
</tr>
</table>
<p class="titolo">Bici Mountain Bike</p>
</div>
<div id="scheda">
<p class="titolo">Bici selezionata</p>
<table id="tabella2">
<tr>
<td>Modello</td>
<td class="cellaVuota"></td>
</tr>
<tr>
<td>Misura 27.5</td>
<td class="cellaVuota"></td>
</tr>
<tr>
<td>Misura 29</td>
<td class="cellaVuota"></td>
</tr>
</table>
</div>
</div>
I searched and searched here before post this question (see position and ~top` properties in the CSS code), but I do not figure out how to reach my purpose.
Just add vertical-align: top; to both divs.
You can also remove position: relative; and top: 0; properties

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