Make text in a HTML table cell overlap other cells

前端 未结 2 1534
说谎
说谎 2021-01-14 04:03

I want to have some longer text in a cell to overlap in the next cell instead of wrapping, but without making the first column bigger.

2条回答
  •  心在旅途
    2021-01-14 04:54

    You can make the content of a cell flow into other cells on the same row by setting overflow: visible, preventing line breaks, and setting a fixed width, which also requires fixed table layout. You also need to set a fixed width for the table as a while, because otherwise browsers won’t do fixed table layout.

    
    
    nrnameyearcategoryprice
    A longer line that should not wrap , but go over the other cells
    999.0 Some name 2000 Some category 135.32

    This is so complicated that you should probably do what @MikeW suggests, which does not make the cell content overflow to other cells but makes the cell span all the five columns.

提交回复
热议问题