table-cell - some kind of colspan?

前端 未结 8 1819
甜味超标
甜味超标 2020-12-06 09:46

I am a bit puzzled right now, because I had CSS code that worked, but it wasn\'t beautiful at all. I now want to rework this CSS styles and build them via LESS. And I have b

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 10:32

    One idea would be to leverage absolute positioning. Relative position a wrapper around the table, then all absolute positioning becomes coordinate centric to the wrapper. See below. Notice I define a class of tableWrapper which will be set position:relative, then define class of tableRow and - I'm assuming you'll set .tableRow div { display: table-cell; } so I didn't bother putting a class on each div. You'll have to find a way to prevent it from overlapping the div below it if it's height gets larger than the 2nd div. Should be very doable.

    Column 1
    Column 2
    appears like colspan=2
      (only here to force a row break before the next table row)
    Column 1
    Column 2

提交回复
热议问题