CSS element keeps going to new line - html

I want to keep the text block always on the first line, and if it needs multiple lines, then those lines should always get created beneath the first line of text.
The objective is that you only see dates on the left part of the page.
what is happening:
enter image description here
what should be happening:
enter image description here
/* Magic */
* {
margin: 0;
padding: 0;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
ul {
margin-left:20px;
}
/* MAIN STRUCTURE */
.page {
margin: 20px 20px 20px 20px;
font-size: 1.1rem;
}
#header {
width: 100%;
z-index: 1;
display: inline-block;
}
.section {
margin-top: 15px;
display: inline-block;
width: 100%;
}
/* Header */
#title {
float: left;
font-size: 1.3rem;
}
#meta {
float: right;
}
/* section */
.timeline_entry {
display: inline-block;
width: 100%;
margin-bottom: 1rem;
}
.entry {
display: inline-block;
width: 100%;
}
#identity {
}
#current {
}
#actions {
}
#stats {
}
#listing {
}
/* entry */
.element {
display: inline-block;
margin-right: 0.8rem;
}
.word {
display: inline-block;
}
#editing{
display: inline-block;
text-align: left;
float: right;
}
#proposal_status {
}
#proposal_text {
}
/* header */
#user_actions{
}
<div class="section" id="listing">
<div class="timeline_entry">
<div class="entry">
<div class="element">
<div class="word">2015-09-23</div>
<div class="word">#</div>
</div>
<div class="element">This is a long text which is going to the second line because its so big you know? more text, moarr</div>
</div>
<div class="entry">
<div class="element">
<div class="word">2015-09-23</div>
<div class="word">#</div>
</div>
<div class="element">Achieved</div>
<div class="element">Talk (5)</div>
<div class="element">
<div class="word">Category</div>
<div class="word">Category</div>
</div>
</div>
</div>
<div class="timeline_entry">
<div class="entry">
<div class="element">
<div class="word">2015-09-23</div>
<div class="word">#</div>
</div>
<div class="element">This text stays where it should</div>
</div>
<div class="entry">
<div class="element">
<div class="word">2015-09-23</div>
<div class="word">#</div>
</div>
<div class="element">Achieved</div>
<div class="element">Talk (5)</div>
<div class="element">
<div class="word">Category</div>
<div class="word">Category</div>
</div>
</div>
</div>
</div>

you could try playing around with HTMLs much underloved "Deffinition List" <dl>
Alternatively, here's a table-like layout:
.list-group {
display:table;
width:100%;
max-width:500px;
}
.item {
display:table-row;
}
.date {
display:table-cell;
width:30%;
padding:10px;
vertical-align:top;
text-align:right;
}
.dates {
display:table-cell;
width:70%;
padding:10px;
vertical-align:top;
}
<div class="list-group">
<div class="item">
<div class="date">2015 09 14</div>
<div class="dates">2013123 2013123 2013123 2013123 2013123 2013123 2013123</div>
</div>
<div class="item">
<div class="date">2015 09 14</div>
<div class="dates">2013123 2013123 2013123 2013123 2013123 2013123 2013123</div>
</div>
<div class="item">
<div class="date">2015 09 14</div>
<div class="dates">2013123 2013123 2013123 2013123 2013123 2013123 2013123</div>
</div>
<div class="item">
<div class="date">2015 09 14</div>
<div class="dates">2013123 2013123 2013123 2013123 2013123 2013123 2013123</div>
</div>
</div>

I was hoping to comment but I don't have enough rep points to do so, but would the below work?
JSFiddle: https://jsfiddle.net/4r295p0q/2/
This won't work if your class assignments aren't flexible because I changed the classes of the two DIV's with the text from .element (red border) to .post (blue border). From there, I gave the new .post class an pre-determined width percentage and float: right.

Related

Nested DIV table displays incorrectly

I have problems coding a nested DIV table:
.divTable {
display: table;
width: 100%;
}
.divTableRow {
display: table-row;
}
.divTableHeading {
background-color: #EEE;
display: table-header-group;
}
.divTableCell,
.divTableHead {
display: table-cell;
padding: 3px 10px;
}
.divTableHeading {
background-color: #EEE;
display: table-header-group;
font-weight: bold;
}
.divTableFoot {
background-color: #EEE;
display: table-footer-group;
font-weight: bold;
}
.divTableBody {
display: table-row-group;
}
.divTable2 {
display: table;
width: 100%;
}
.divTable2Row {
display: table-row;
}
.divTable2Cell,
.divTable2Body {
display: table-row-group;
}
<div class="divTable">
<div class="divTableBody">
<div class="divTableRow">
<!-- this row contains a nested 2x2 table -->
<div class="divTableCell">outer left </div>
<div class="divTableCell">outer right
<div class="divTable2">
<div class="divTable2Body">
<div class="divTable2Row">
<div class="divTable2Cell">inner 1st line left</div>
<div class="divTable2Cell">inner 1st line right</div>
</div>
<div class="divTable2Row">
<div class="divTable2Cell">inner 2nd line left</div>
<div class="divTable2Cell">inner 2nd line right</div>
</div>
</div>
</div>
</div>
</div>
<div class="divTableRow">
<!-- no nested table here -->
<div class="divTableCell">outer left</div>
<div class="divTableCell">outer right</div>
</div>
</div>
<!-- end div divTable Body -->
</div>
<!-- end div divTable -->
https://jsfiddle.net/jsrookey/0z0agxad/
The nested table cells are not on the same table row line, but underneath each other, strangely.
That's because .divTable2Cell has display: table-row-group; instead of display: table-cell;.
.divTable {
display: table;
width: 100%;
}
.divTableRow {
display: table-row;
}
.divTableHeading {
background-color: #EEE;
display: table-header-group;
}
.divTableCell,
.divTable2Cell,
.divTableHead {
display: table-cell;
padding: 3px 10px;
}
.divTableHeading {
background-color: #EEE;
display: table-header-group;
font-weight: bold;
}
.divTableFoot {
background-color: #EEE;
display: table-footer-group;
font-weight: bold;
}
.divTableBody {
display: table-row-group;
}
.divTable2 {
display: table;
width: 100%;
}
.divTable2Row {
display: table-row;
}
.divTable2Body {
display: table-row-group;
}
<div class="divTable">
<div class="divTableBody">
<div class="divTableRow">
<!-- this row contains a nested 2x2 table -->
<div class="divTableCell">outer left </div>
<div class="divTableCell">outer right
<div class="divTable2">
<div class="divTable2Body">
<div class="divTable2Row">
<div class="divTable2Cell">inner 1st line left</div>
<div class="divTable2Cell">inner 1st line right</div>
</div>
<div class="divTable2Row">
<div class="divTable2Cell">inner 2nd line left</div>
<div class="divTable2Cell">inner 2nd line right</div>
</div>
</div>
</div>
</div>
</div>
<div class="divTableRow">
<!-- no nested table here -->
<div class="divTableCell">outer left</div>
<div class="divTableCell">outer right</div>
</div>
</div>
<!-- end div divTable Body -->
</div>
<!-- end div divTable -->
FWIW you have some unnecessary duplication in CSS classes, i.e. the following are the same:
.divTable, .divTable2
.divTableBody, .divTable2Body
.divTableRow, .divTable2Row
.divTableCell, .divTable2Cell
etc.
Merge them into a single class.
.table {
display: table;
width: 100%;
}
.tbody {
display: table-row-group;
}
.thead {
background-color: #EEE;
display: table-header-group;
font-weight: bold;
}
.tfoot {
background-color: #EEE;
display: table-footer-group;
font-weight: bold;
}
.tr {
display: table-row;
}
.td,
.th {
display: table-cell;
padding: 3px 10px;
}
<div class="table">
<div class="tbody">
<div class="tr">
<div class="td">outer left </div>
<div class="td">outer right
<div class="table">
<div class="tbody">
<div class="tr">
<div class="td">inner 1st line left</div>
<div class="td">inner 1st line right</div>
</div>
<div class="tr">
<div class="td">inner 2nd line left</div>
<div class="td">inner 2nd line right</div>
</div>
</div>
</div><!-- .table -->
</div>
</div>
<div class="tr">
<div class="td">outer left</div>
<div class="td">outer right</div>
</div>
</div>
</div>

Place banners side by side using HTML/CSS?

How to put banners side by side using HTML/CSS? Ideally with different sizes as shown below?
One simple way would be to display the banners inline-block, and assign them the required width.
.banner {
display: inline-block;
}
.banner-sm {
width: 32%;
}
.banner-lg {
width: 65%;
}
.banner {
height: 100px;
background: #DDD;
padding: 0; margin: 0;
}
<div class="row">
<div class="banner banner-lg"> </div>
<div class="banner banner-sm"> </div>
</div>
<div class="row">
<div class="banner banner-sm"> </div>
<div class="banner banner-sm"> </div>
<div class="banner banner-sm"> </div>
</div>
<div class="row">
<div class="banner banner-sm"> </div>
<div class="banner banner-lg"> </div>
</div>
Either use some grid system, or the bare CSS float property, pseudo example shown below:
.banner1 {
float: left;
width: 100px;
height: 20px;
margin: 4px;
border: 1px solid #777;
}
.banner2 {
float: left;
width: 200px;
height: 20px;
margin: 4px;
border: 1px solid #777;
}
.banner3 {
float: left;
width: 50px;
height: 20px;
margin: 4px;
border: 1px solid #777;
}
.clearfix {
clear: both;
}
<div class="banner1">banner</div>
<div class="banner1">banner</div>
<div class="clearfix"></div>
<div class="banner2">banner</div>
<div class="clearfix"></div>
<div class="banner3">banner</div>
<div class="banner3">banner</div>
<div class="banner3">banner</div>
<div class="banner3">banner</div>
<div class="clearfix"></div>
Good luck
You can use Twitter Bootstrap to get grid system and other useful layout functionality:
.row div {
height: 30px;
background: #aaa;
border: 1px solid #ddd;
}
* {
box-sizing: border-box;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class='row'>
<div class='col-xs-8'></div>
<div class='col-xs-4'></div>
</div>
<div class='row'>
<div class='col-xs-4'></div>
<div class='col-xs-4'></div>
<div class='col-xs-4'></div>
</div>
<div class='row'>
<div class='col-xs-4'></div>
<div class='col-xs-8'></div>
</div>
<div class='row'>
<div class='col-xs-4'></div>
<div class='col-xs-8'></div>
<div class='col-xs-8'></div>
<div class='col-xs-4'></div>
</div>
If you are familiar with twitter-bootstrap then use its Grid system otherwise using inline-block will help you.
div {
border: 1px solid #ddd;
height: 200px;
margin: 5px;
display: inline-block;
box-sizing:border-box;
}
<section style="width:650px">
<div style="width:415px;"></div>
<div style="width:200px;"></div>
<div style="width:200px;"></div>
<div style="width:200px;"></div>
<div style="width:200px;"></div>
<div style="width:200px;"></div>
<div style="width:415px;"></div>
</section>
you can use CSS3 flex-box concept
.flex-container {
display: -webkit-flex;
display: flex;
width: 400px;
height: 250px;
background-color: lightgrey;
flex-direction:column;
}
.flex-item {
background-color: cornflowerblue;
width: calc(100% - 20px);
height: 100px;
margin: 10px;
display:flex;
justify-content:space-between;
}
.sub{
height:100%;
background:white;
box-sizing:border-box;
}
.one{
width:75%;
border:1px solid green;
}
.two{
width:25%;
border:1px solid red;
}
.subb{
width:33%;
background:white;
height:100%;
}
<div class="flex-container">
<div class="flex-item">
<div class="sub one">sub 1 </div>
<div class="sub two">sub 2 </div>
</div>
<div class="flex-item">
<div class="subb s3">sub 3 </div>
<div class="subb s4">sub 4 </div>
<div class="subb s5">sub 5 </div>
</div>
</div>
You can use Bootstrap to do this.
Bootstarp is a Powerful css framework which enables web developer's
to do stuff like these(dividing screens etc).
Bootstrap is very easy to learn and implement.
You can start Learning Bootstrap here

CSS DIV as table - how to make all column same height as the highest

I have some problems with my DIV table.. maybe there is a better way to do this.
I want to have all columns to be the same height as the highest column. Is there a way to do it? or is there another way to make this work ?
I have to made a jsfiddle example here with my code: http://jsfiddle.net/rb500o4L/ (right column is higher than left, middle and the logo column.)
My CSS code:
div.round-border {
border: solid 1px;
border-color: #002F67;
border-radius: 10px;
}
#container {
display: table;
width: 100%;
}
#row {
display: table-row;
}
#cell {
display: table-cell;
}
#cell-logo {
display: table-cell;
width: 200px;
}
My HTML code:
<div id="container">
<div id="row">
<div id="cell">
<div class="round-border">
<h4>Left Col</h4>
<p>...</p>
</div>
</div>
<div id="cell">
<div class="round-border">
<h4>Middle Col</h4>
<p>...</p>
</div>
</div>
<div id="cell">
<div class="round-border">
<h4>Right Col</h4>
<p>...</p>
<p>...</p>
</div>
</div>
<div id="cell-logo">
<div class="round-border">
<h4>LOGO AREA</h4>
<p>...</p>
</div>
</div>
</div>
</div>
I appreciate any recommendation.
use this css
div.round-border {
border: solid 1px;
border-color: #002F67;
border-radius: 10px;
}
container {
width: 100%;
}
row {
height:auto;
}
#cell
{
height:auto;
min-height:400px;
width:50px;
display:inline-block;
}
#cell-logo {
width: 50px;
}

Inner divs padding affects outer div positioning. (margin collapsing?)

I have the following HTML:
<p>messy</p>
<div class="row">
<div class="cell">
<div class="one wrapper">1</div>
</div>
<div class="cell">
<div class="two wrapper">2</div>
</div>
<div class="cell">
<div class="three wrapper">
<div class="foo">3</div>
</div>
</div>
</div>
<p>good</p>
<div class="row">
<div class="cell">
<div class="one wrapper">1</div>
</div>
<div class="cell">
<div class="two wrapper">2</div>
</div>
<div class="cell">
<div class="three wrapper">3</div>
</div>
</div>
With this CSS:
.row {
display: table;
table-layout: fixed;
overflow: hidden;
background-color:blue;
width:100%;
}
.cell {
display: table-cell;
overflow: hidden;
padding: 0;
}
.wrapper {
overflow: hidden;
position: relative;
padding:0;
display: block;
height:42px;
background-color:red;
}
.one {
width:100px;
}
.two {
width:40px;
}
.three {
width:100px;
}
.foo {
padding: 10px;
}
You can see the fiddle here.
Why is three messing up the layout in case a child has a padding? I've read various articles about margin collapsing in the past, but I could'nt fix this layout using one of the techniques.
It's simple just add vertical-align: middle; in .cell Class.
jsFiddle

Colspan/Rowspan for elements whose display is set to table-cell

I have the following code:
.table {
display: table;
}
.row {
display: table-row;
}
.cell {
display: table-cell;
}
.colspan2 {
/* What to do here? */
}
<div class="table">
<div class="row">
<div class="cell">Cell</div>
<div class="cell">Cell</div>
</div>
<div class="row">
<div class="cell colspan2">Cell</div>
</div>
</div>
Pretty straightforward. How do I add a colspan (or the equivalent of colspan) for elements with display: table-cell?
As far as I know, the lack of colspan/rowspan is just one of the limitations of display:table. See this post:
http://www.onenaught.com/posts/201/use-css-displaytable-for-layout
Since OP does not explicitly rule that solution must be pure CSS, I'll be stubborn and throw in my workaround I figured out today, especially since it's much more elegant than having a table inside a table.
Example equals to <table> with two cells per row and two rows, where the cell in the second row is a td with colspan="2".
I have tested this with Iceweasel 20, Firefox 23 and IE 10.
div.table {
display: table;
width: 100px;
background-color: lightblue;
border-collapse: collapse;
border: 1px solid red;
}
div.row {
display: table-row;
}
div.cell {
display: table-cell;
border: 1px solid red;
}
div.colspan,
div.colspan+div.cell {
border: 0;
}
div.colspan>div {
width: 1px;
}
div.colspan>div>div {
position: relative;
width: 99px;
overflow: hidden;
}
<div class="table">
<div class="row">
<div class="cell">cell 1</div>
<div class="cell">cell 2</div>
</div>
<div class="row">
<div class="cell colspan">
<div><div>
cell 3
</div></div>
</div>
<div class="cell"></div>
</div>
</div>
Live action (demo) here.
EDIT:
I finetuned the code to be more printer-friendly, as they leave background-colors out by default. I also created rowspan-demo, inspired by late answer here.
A simpler solution that works for me in Chrome 30 :
Colspan can be emulated by using display: table instead of display: table-row for the rows :
.table {
display: block;
}
.row {
display: table;
width: 100%;
}
.cell {
display: table-cell;
}
.row.colspan2 {/* You'll have to add the 'colspan2' class to the row, and remove the unused <div class=cell> inside it */
display: block;
}
The only pitfall is that the cells of stacked rows won't align vertically, as they're from different tables.
If you're looking for a straight CSS way to simulate a colspan, you could use display: table-caption.
.table {
display: table;
}
.row {
display: table-row;
}
.cell {
display: table-cell;
border: 1px solid #000;
}
.colspan2 {
/* What to do here? */
display: table-caption;
}
<div class="table">
<div class="row">
<div class="cell">Cell</div>
<div class="cell">Cell</div>
</div>
<div class="row">
<div class="cell colspan2">Cell</div>
</div>
</div>
Simply use a table.
table's are only frowned upon when being used for layout purposes.
This seems like tabular data (rows/columns of data). Therefore I would recommend using a table.
See my answer to this question for more information:
creating the same thing with divs as tables
Here's one way to span columns in CSS I used for my own situation.
https://jsfiddle.net/mb8npttu/
.table {
display: table;
}
.row {
display: table-row;
}
.cell {
display: table-cell;
border: 1px dotted red;
}
.colspan {
max-width: 1px;
overflow: visible;
}
<div class='table'>
<div class='row'>
<div class='cell colspan'>
spanning
</div>
<div class='cell'></div>
<div class='cell'></div>
</div>
<div class='row'>
<div class='cell'>1</div>
<div class='cell'>2</div>
<div class='cell'>3</div>
</div>
</div>
There is a solution to make the colspan the widht of the entire table. You can not use this technique to colspan a part of the table.
Code:
* {
box-sizing: border-box;
}
.table {
display: table;
position: relative;
}
.row {
display: table-row;
}
.cell {
display: table-cell;
border: 1px solid red;
padding: 5px;
text-align: center;
}
.colspan {
position: absolute;
left: 0;
width: 100%;
}
.dummycell {
border-color: transparent;
}
<div class="table">
<div class="row">
<div class="cell">Cell</div>
<div class="cell">Cell</div>
</div>
<div class="row">
<div class="cell dummycell"> </div>
<div class="cell colspan">Cell</div>
</div>
<div class="row">
<div class="cell">Cell</div>
<div class="cell">Cell</div>
</div>
</div>
Explanation:
We use position absolute on the colspan to make it the full width of the table. The table itself needs position relative. We make use of a dummycell to maintain the height of the rows, position absolute does not follow the flow of the document.
Of course you can also use flexbox and grid to tackle this problem these days.
CSS
.tablewrapper {
position: relative;
}
.table {
display: table;
position: relative
}
.row {
display: table-row;
}
.cell {
border: 1px solid red;
display: table-cell;
}
.cell.empty
{
border: none;
width: 100px;
}
.cell.rowspanned {
position: absolute;
top: 0;
bottom: 0;
width: 100px;
}
.cell.colspan {
position: absolute;
left: 0;
right: 0;
}
HTML
<div class="tablewrapper">
<div class="table">
<div class="row">
<div class="cell rowspanned">
Center
</div>
<div class="cell">
Top right
</div>
</div>
<div class="row">
<div class="cell empty"></div>
<div class="cell colspan">
Bottom right
</div>
</div>
</div>
</div>
Code
It can be done just with pure CSS and centering the text across the "fake" colspan.
The trick is to set the rows to position:relative, then to place "empty divs" in the row where you want to make the colspan (they must have height in order to work), set the cell where the content is in as display:grid, and finally, applying position:absolute to the element inside the cell (and center it as you may center any other absolute element).
.table {
display: table;
}
.row {
display: table-row;
position: relative;
}
.cell {
display: table-cell;
background-color: blue;
color: white;
height: 26px;
padding: 0 8px;
}
.colspan2 {
display: grid;
}
.colspan2 p {
position:absolute;
left: 50%;
transform:translateX(-50%);
margin: 0;
}
<div class="table">
<div class="row">
<div class="cell">Cell</div>
<div class="cell">Cell</div>
</div>
<div class="row">
<div class="cell colspan2"><p>Cell</p></div>
<div class="cell"></div>
</div>
</div>
By using the appropriate div classes and CSS attributes, you can mimic the desired effects of the colspan and rowspan.
Here's the CSS
.table {
display:table;
}
.row {
display:table-row;
}
.cell {
display:table-cell;
padding: 5px;
vertical-align: middle;
}
Here's the sample HTML
<div class="table">
<div class="row">
<div class="cell">
<div class="table">
<div class="row">
<div class="cell">X</div>
<div class="cell">Y</div>
<div class="cell">Z</div>
</div>
<div class="row">
<div class="cell">2</div>
<div class="cell">4</div>
<div class="cell">6</div>
</div>
</div>
</div>
<div class="cell">
<div class="table">
<div class="row">
<div class="cell">
<div class="table">
<div class="row">
<div class="cell">A</div>
</div>
<div class="row">
<div class="cell">B</div>
</div>
</div>
</div>
<div class="cell">
ROW SPAN
</div>
</div>
</div>
</div>
</div>
</div>
From what I'm seeing in both the questions, and most responses, is people seem to forget that in any given div that's acting as a "table-cell" you can insert another div that's acting like an embedded table, and start the process over.
***It's not glamorous, but it does work for those looking for this type of formatting and they want to avoid the TABLEs. If its for DATA LAYOUT, TABLEs do still work in HTML5.
Hopefully, this will help someone.
You can set the position of colspan content as "relative" and the row as "absolute" like this:
.table {
display: table;
}
.row {
display: table-row;
position: relative;
}
.cell {
display: table-cell;
}
.colspan2 {
position: absolute;
width: 100%;
}
You can't achieve this at present.
AFAIK this would be covered by CSS Tables, a specification which appears to currently be at "work in progress" state.
You can try this solution, where you can find how to apply colspan using div
https://codepen.io/pkachhia/pen/JyWMxY
HTML:
<div class="div_format">
<div class="divTable">
<div class="divTableBody">
<div class="divTableRow">
<div class="divTableCell cell_lable">Project Name</div>
<div class="divTableCell cell_value">: Testing Project</div>
<div class="divTableCell cell_lable">Project Type</div>
<div class="divTableCell cell_value">: Web application</div>
</div>
<div class="divTableRow">
<div class="divTableCell cell_lable">Version</div>
<div class="divTableCell cell_value">: 1.0.0</div>
<div class="divTableCell cell_lable">Start Time</div>
<div class="divTableCell cell_value">: 2016-07-10 11:00:21</div>
</div>
<div class="divTableRow">
<div class="divTableCell cell_lable">Document Version</div>
<div class="divTableCell cell_value">: 2.0.0</div>
<div class="divTableCell cell_lable">End Time</div>
<div class="divTableCell cell_value">: 2017-07-10 11:00:23</div>
</div>
<div class="divTableRow">
<div class="divTableCell cell_lable">Document Revision</div>
<div class="divTableCell cell_value">: 3</div>
<div class="divTableCell cell_lable">Overall Result</div>
<div class="divTableCell cell_value txt_bold txt_success">: Passed</div>
</div>
</div>
<div class="divCaptionRow">
<div class="divCaptionlabel">Description</div>
<div class="divCaptionValue">: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore</div>
</div>
</div>
</div>
CSS:
body {
font-family: arial
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box
}
.div_format {
width: 100%;
display: inline-block;
position: relative
}
.divTable {
display: table;
width: 100%;
}
.divTableRow {
display: table-row
}
.divTableHeading {
background-color: #EEE;
display: table-header-group
}
.divTableCell,
.divTableHead {
display: table-cell;
padding: 10px
}
.divTableHeading {
background-color: #EEE;
display: table-header-group;
font-weight: bold
}
.divTableFoot {
background-color: #EEE;
display: table-footer-group;
font-weight: bold
}
.divTableBody {
display: table-row-group
}
.divCaptionRow{
display: table-caption;
caption-side: bottom;
width: 100%;
}
.divCaptionlabel{
caption-side: bottom;
display: inline-block;
background: #ccc;
padding: 10px;
width: 15.6%;
margin-left: 10px;
color: #727272;
}
.divCaptionValue{
float: right;
width: 83%;
padding: 10px 1px;
border-bottom: 1px solid #dddddd;
border-right: 10px solid #fff;
color: #5f5f5f;
text-align: left;
}
.cell_lable {
background: #d0d0d0;
border-bottom: 1px solid #ffffff;
border-left: 10px solid #ffffff;
border-right: 10px solid #fff;
width: 15%;
color: #727272;
}
.cell_value {
border-bottom: 1px solid #dddddd;
width: 30%;
border-right: 10px solid #fff;
color: #5f5f5f;
}
Use nested tables to nest column spans...
<div class="table">
<div class="row">
<div class="cell">
<div class="table">
<div class="row">
<div class="cell">Cell</div>
<div class="cell">Cell</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="cell">Cell</div>
</div>
</div>
Or use 2 tables where the column span covers the whole row...
<div class="table">
<div class="row">
<div class="cell">Cell</div>
<div class="cell">Cell</div>
</div>
</div>
<div class="table">
<div class="row">
<div class="cell">Cell</div>
</div>
</div>
Even if this is an old question, I would like to share my solution to this problem.
<div class="table">
<div class="row">
<div class="cell">Cell</div>
<div class="cell">Cell</div>
</div>
<div class="row">
<div class="cell colspan">
<div class="spanned-content">Cell</div>
</div>
</div>
</div>
<style>
.table {
display: table;
}
.row {
display: table-row;
}
.cell {
display: table-cell;
}
.colspan:after {
/* What to do here? */
content: "c";
display: inline;
visibility: hidden;
}
.spanned-content {
position: absolute;
}
</style>
Here is a fiddle.
It's not really a span, and the solution is a bit hacky, but it is usefull in some situations. Tested on Chrome 46, Firefox 31 and IE 11.
In my case, I had to present some non-tabular data in a tabular way, keeping the width of the columns and giving title to sub-sections of the data.