Divide HTML table rows into labelled sections

后端 未结 5 1765
难免孤独
难免孤独 2021-01-03 19:54

Is there a valid way to divide a table\'s rows into sections, with a label identifying that section?

For example, something like the code below, but with a header o

5条回答
  •  孤城傲影
    2021-01-03 20:52

    In response to Alexander Suraphel's question on Martin's answer, yes, the OP wanted to have an identifying label. Here's one way to, combining some of the aspects of several answers, to do that. (Note that I have supplied my own labels, as the OP didn't specify what labels they would have used.)

    td {
      border-left: 0;
      border-top: 0;
      border-bottom: 0;
      border-right: 0;
    }
    
    table {
      border: none;
      border-collapse: collapse;
    }
    
    .grouplabel {
      background: blue;
      color: yellow;
      border: 1px solid blue;
      border-radius: 5px;
    }
    Fruits Vitamin A Vitamin C
    Local
    Apples 98 ui 8.4 mg
    Imported
    Oranges 295 ui 69.7 mg
    Bananas 76 ui 10.3 mg

提交回复
热议问题