Creating a table using only CSS

I need a table layout that looks like this:

Cell One (rowspan 2)

Cells two and three (next to the cell one and one other)

Fourth cell (colspan 2 under cell two and three)

The problem I am facing is that this needs to be done only using CSS, I can’t use any table elements in the code at all.

Cell 1 should also be stretched to 100% of the width if cells 2, 3, and 4 are empty.

I am working on an Artisteer 4 template in Joomla and have been looking for everything and just can't get to the working solution.

The code I have is as follows:

<div class="prof-layout-wrapper">
   <div class="prof-content-layout">
      <div class="prof-content-layout-row">
         <div class="prof-layout-cell prof-content">
<?php
 echo $view->position('banner2', 'prof-nostyle');
 if ($view->containsModules('breadcrumb'))
 echo artxPost($view->position('breadcrumb'));
 echo $view->positions(array('user1' => 50, 'user2' => 50), 'prof-article');
 echo $view->position('banner3', 'prof-nostyle');
 echo artxPost(array('content' => '<jdoc:include type="message" />', 'classes' => ' prof-m  essages'));
 echo '<jdoc:include type="component" />';
 echo $view->position('banner4', 'prof-nostyle');
 echo $view->positions(array('user4' => 50, 'user5' => 50), 'prof-article');
 echo $view->position('banner5', 'prof-nostyle');?>
 </div>
 <?php if ($view->containsModules('left')) : ?>
   <div class="prof-layout-cell prof-sidebar1">
     <?php echo $view->position('left', 'prof-block'); ?>
   </div>
  <?php endif; ?>
 <?php if ($view->containsModules('right')) : ?>
    <div class="prof-layout-cell prof-sidebar2">
       <?php echo $view->position('right', 'prof-block'); ?>
    </div>
        <?php endif; ?>
       </div>
     </div>
   </div>

Css value:

.prof-layout-wrapper
{
  position: relative;
  margin: 0 auto 0 auto;
  z-index: auto !important;
 }

.prof-content-layout
{
  display: table;
  width: 100%;
  table-layout: fixed;    
  float: left;
}

.prof-content-layout-row
{
   display: table-row;
 }

.prof-layout-cell
{
  display: table-cell;
  vertical-align: top;
}

Throughout life, I can’t get Cell 4 to overcome everything without destroying the entire layout.

Please, help!

(I hope this is a good enough explanation)

+4
1

!

-

HTML

<div class='table'>
    <div class='row'>
        <div class='cell'>cell1</div>
        <div class='cell'>
            <div class='table'>
                <div class='row'>
                    <div class='cell'>cell2</div>
                    <div class='cell'>cell3</div>
                </div>
                <div class='caption'>cell4</div>
            </div>
        </div>
    </div>
</div>

CSS

html, body {
    width:100%;
}
.table {
    display:table;
    width:100%;
}
.row {
    display:table-row;
}
.cell {
    display:table-cell;
    border:1px solid grey;
}
.caption {
    display:table-caption;
    caption-side:bottom;
    border:1px solid grey;
}

/, , a la this fiddle

+4

Source: https://habr.com/ru/post/1530026/


All Articles