How to create tables from column data instead of row data in HTML?

前端 未结 6 1771
抹茶落季
抹茶落季 2020-12-14 06:11

According to this article at W3 Schools, one can create a basic table in HTML like this:

row 1, c
6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-14 06:37

    Just did this by using a bunch of uls filled with lis, seemed a lot cleaner than anything I could find. You'll have to do something like adding a class to all the uls and setting its style to display: inline-table.

    @* pseudo html/razor *@
    @foreach(var col in columns){
        
      foreach(var data in col){
    • data
    • }
    }

    and some styling

    .tableColumn {
        border: 1px solid;
        display: inline-table;
    }
    

提交回复
热议问题