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

前端 未结 6 1769
抹茶落季
抹茶落季 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:28

    In modern browsers you can achieve this by redefining the TR and TD tags behavior in CSS. Given the HTML in your question attach the next CSS style:

    table {
    	display: table;
    }
    table tr {
    	display: table-cell;
    }
    table tr td {
    	display: block;
    }
    row 1, cell 1 row 2, cell 1
    row 1, cell 2 row 2, cell 2

提交回复
热议问题