javascript - Is there a way to create tables like nested lists? (image for reference) -


in app, user can select of followers see of followers.

i want result of function appear image: followers , follower's followers (please don't mind wrong spacing)

but haven't been able nest tables or shift table rows left or right.

here's code have used generate image:

table {    position: relative;    left: 126px;    margin-left: 16px;    margin-top: 16px;    border-collapse: collapse;  }  .avatar {    width: 52px;    height: 52px;    border-radius: 50%;    background-color: #abc;    float: left;    margin-right: 20px;  }  tr {    height: 70px;    width: 732px;  }  td {    height: 70px;    margin: 0px;  }  p {    margin-right: 16px;    line-height: 70px;  }  .flldfll {    margin-top: 0px;    margin-left: 91px;  }
<div id="complist">    <table class="fll">          <tr>        <td>          <div class="avatar"></div>        </td>        <td>          <p>nome cognome</p>        </td>        <td>          <p>@nickname</p>        </td>        <td>          <p>id</p>        </td>      </tr>      </table>      <table class="flldfll">          <tr>        <td>          <div class="avatar"></div>        </td>        <td>          <p>nome cognome</p>        </td>        <td>          <p>@nickname</p>        </td>        <td>          <p>id</p>        </td>      </tr>          </table>      <table class="fll">          <tr>        <td>          <div class="avatar"></div>        </td>        <td>          <p>nome cognome</p>        </td>        <td>          <p>@nickname</p>        </td>        <td>          <p>id</p>        </td>      </tr>      </table>      <table class="fll">          <tr>        <td>          <div class="avatar"></div>        </td>        <td>          <p>nome cognome</p>        </td>        <td>          <p>@nickname</p>        </td>        <td>          <p>id</p>        </td>      </tr>      </table>        </div>

here's pseudocode of yo accomplish:

int count= 10; //numbers of followers show for(i<count, i++){     generate yourfollowers <tr>s;         if(yourfollowers.id == followerpreviouslyselected.id) {             for(j<count, j++){                 generate followersfollowers <tr>s; //<tr>s shifted right             }         } } 

is there proper way reach goal? (i'm working jsp pages)

thanks in advance!

i don't know if there's 1 "best practice" way of doing this, how approach it:

first, use <ul> normal. however, can have table elements inside of <ul>. example:

<ul>     <li>         <table class="listtable">             <tr>                 <td>                     content                 </td>             </tr>         </table>     </li>     <li>         <table>...</table>         <ul>             <!-- done in first li here -->         </ul>     </li> </ul> 

so, can see, within each <li> have self contained table, , style necessary .listtable. also, instead of using tables (which aren't mobile friendly), use <div>'s given styling like:

div.listtableelement {     display: inline-table;     ... } 

possibly adding in fixed/% based widths .listtableelement.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -