html - CSS: Distribute non-table elements in table-like manner -


having div containing dynamically generated <span>s possible display them in table-like manner , decide goes column of table? have:

<div>  <span class="left">left1</span>  <span class="right">right1</span>  <span class="left">left2</span>  <span class="center">center1</span>  </div>

this want achieve (i don't mean code visualization please run snippet):

<table>    <tr>      <td>left1</td>      <td>center1</td>      <td>right1</td>    </tr>    <tr>      <td>left2</td>    </tr>    </table>

unfortunately don't have possibility have table generated or change order of <span>s.

don't unless there no other option change markup!

if unknown reason have absolutely use this.
here css center .center class.
put .right on right. , put second left on new line.

div {    position: relative;    display: inline-block;    width: 200px;    height: 2em;  }  .center {    display: inline-block;    position: absolute;    left: 50%;    transform: translate(-50%);  }  .left:nth-of-type(3) {    position: absolute;    bottom: 0px;    left: 0px;  }  .right {    float: right;  }
<div>    <span class="left">left1</span>    <span class="right">right1</span>    <span class="left">left2</span>    <span class="center">center1</span>  </div>


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -