This probably isn't the solution you're expecting, I would really encourage you to look at the new CSS Flexible Box Model instead of using HTML tables as it'll make your life much easier in these sort of scenarios.
If you're interested, take a look at my answer for a very similar question at Vertical Menu (+ Sub-Menu) stacks unnaturally .
Use display: flex
on your tbody
and set an evenly divided flex-basis
on your table rows.
body {
font-size : 20px ;
font-family : monospace;
}
table {
width : 100% ;
height : 100vh ;
display : flex;
justify-content : center;
align-items : center;
}
tbody {
display : flex;
width : 800px ;
position : relative;
align-items : stretch;
border : 1px solid black;
}
tr {
flex-basis : 33.33333333% ;
display : flex;
flex-wrap : wrap;
align-content : flex-start;
padding : 5px 10px ;
}
tr + tr {
border-left : 1px solid black;
}
th , td {
flex-basis : 100% ;
text-align : left;
display : flex;
padding : 2px ;
}
th {
font-weight : bold;
}
Copy <table id ="tabla" > <tbody > <tr > <th > row1</th > <td > aaaa</td > </tr > <tr > <th > row2</th > <td > bbbb</td > </tr > <tr > <th > row3</th > <td > cccc</td > <td > <figure > <img src ="https://via.placeholder.com/150" /> </figure > </td > </tr > </tbody > </table >
Copy CodePen: https://codepen.io/jeffdaley/pen/WmgNRb?editors=1100
Borders might give you some trouble, but this should put you on the right track.
I wonder why everybody is complicating this question. The answer is simple and clear, If you follow the right format of html table you probably wouldn`t face that problem.
<table id ="tabla" > <thead > <th class ="rb" > row1</th > <th class ="rb" > row2</th > <th > row3</th > </thead > <tbody > <tr > <td class ="rb" > aaaa</td > <td class ="rb" > bbbb</td > <td > cccc</td > </tr > <tr > <td colspan ="2" class ="rb" > </td > <td > <figure > <img src ="image.png" /> </figure > </td > </tr > </tbody > </table >
.rb{
border-right: 1px solid #ccc;
}
Copy Just simple and basic like that...
Post a Comment for "Change Orientation To Vertical, Table Rows Html + Css"