css tables for rowspan and colspan

前端 未结 2 416
终归单人心
终归单人心 2020-12-11 09:57

I am creating a table out of div\'s and need a method replicating the effect of a cell that spans 5 rows and a cell that spans 2 columns.

This is what I have for a f

2条回答
  •  星月不相逢
    2020-12-11 10:21

    First of all, take a look at Display Properties

    In CSS3, you have ALL possibilities a table has, and then some more. You aren't using any of them, so give it a try

    If you're dead set on your approach, try the Column Count property. I really don't understand your code, so for the sake of it, here's a generic sample for your 2 columns span

    .cell{
    -webkit-column-count: 2; /* Chrome, Safari, Opera */
    -moz-column-count: 2; /* Firefox */
    column-count: 2;
    }
    

    and for rows, you can simply apply block styles. Then again, you should use the CSS display options. Way easier and a lot less trouble

提交回复
热议问题