Is there a property named “rowgroup” like “colgroup” in XHTML?

后端 未结 6 541
盖世英雄少女心
盖世英雄少女心 2021-01-05 23:02

The following w3c documents mentions rowgroup

  • http://www.w3.org/TR/html401/struct/tables.html#h-11.2.6
  • http://www.w3.org/TR/
相关标签:
6条回答
  • 2021-01-05 23:26

    W3C Spec on the th element shows an example of using scope and multiple rowgroups - i.e. multiple tbody elements.

    Note: The tbody elements in this example identify the range of the row groups.

    <table>
        <thead>
            <tr>
                <th> ID
                <th> Measurement
                <th> Average
                <th> Maximum
        <**tbody**>
            <tr> <td> <th **scope**=rowgroup> Cats <td> <td>
            <tr> <td> 93 <th **scope**=row> Legs <td> 3.5 <td> 4
            <tr> <td> 10 <th **scope**=row> Tails <td> 1 <td> 1
        </**tbody**>
        <**tbody**>
            <tr> <td> <th **scope**=rowgroup> English speakers <td> <td>
            <tr> <td> 32 <th **scope**=row> Legs <td> 2.67 <td> 4
            <tr> <td> 35 <th **scope**=row> Tails <td> 0.33 <td> 1
        </**tbody**>
    </table>
    
    0 讨论(0)
  • 2021-01-05 23:38

    No, there is no such element. If you want to group rows, you can put the particular tr elements in the same class.


    The “rowgroup” you are referring to is a row group that is naturally formed by an element like thead, tbody and tfoot. And Scope is used to define the value set in the same-named attribute scope that is used to refer to the scope the current th element is providing information for:

    <!ELEMENT (TH|TD)  - O (%flow;)*       -- table header cell, table data cell-->
    
    <!-- Scope is simpler than headers attribute for common tables -->
    <!ENTITY % Scope "(row|col|rowgroup|colgroup)">
    
    <!-- TH is for headers, TD for data, but for cells acting as both use TD -->
    <!ATTLIST (TH|TD)                      -- header or data cell --
      %attrs;                              -- %coreattrs, %i18n, %events --
      abbr        %Text;         #IMPLIED  -- abbreviation for header cell --
      axis        CDATA          #IMPLIED  -- comma-separated list of related headers--
      headers     IDREFS         #IMPLIED  -- list of id's for header cells --
      scope       %Scope;        #IMPLIED  -- scope covered by header cells --
      rowspan     NUMBER         1         -- number of rows spanned by cell --
      colspan     NUMBER         1         -- number of cols spanned by cell --
      %cellhalign;                         -- horizontal alignment in cells --
      %cellvalign;                         -- vertical alignment in cells --
      >
    

    Here Scope is a parameter entity with the value (row|col|rowgroup|colgroup). This entity is then refered to in the declaration of the attribute value list of scope with the parameter entity reference %Scope;.

    Parameter entities in SGML are like variables and references to such parameter entities are replaced by its values. That means the following two attribute definitions are equal:

    <!ENTITY % Scope "(row|col|rowgroup|colgroup)">
    <!ATTLIST (FOOBAR)
      scope       %Scope;        #IMPLIED
    >
    
    <!ATTLIST (FOOBAR)
      scope       (row|col|rowgroup|colgroup)        #IMPLIED
    >
    
    0 讨论(0)
  • 2021-01-05 23:43

    The link that you posted in your question answers the question for you. Row groups are defined by the thead, tfoot and tbody elements. In the other part you mention, rowgroup is simply a value for the scope attribute.

    0 讨论(0)
  • 2021-01-05 23:48

    You can group sections of rows in a table using

    • thead to represent the block of rows that consist of the column labels (headers)
    • tbody to represent a block of rows that consist of a body of data
    • tfoot to represent the block of rows that consist of the column summaries (footers)
    0 讨论(0)
  • 2021-01-05 23:50

    There is no such element, however I think that TBODY does what you need - contains all the relevant data rows in your table. So, you can create your styles using CSS statements like TBODY TD {color:red}

    0 讨论(0)
  • 2021-01-05 23:52

    Table rows may be grouped into a table head, table foot, and one or more table body sections, using the THEAD, TFOOT and TBODY elements, respectively. This division enables user agents to support scrolling of table bodies independently of the table head and foot. When long tables are printed, the table head and foot information may be repeated on each page that contains table data.

    The table head and table foot should contain information about the table's columns. The table body should contain rows of table data.

    When present, each THEAD, TFOOT, and TBODY contains a row group. Each row group must contain at least one row, defined by the TR element.

    Source: http://www.w3.org/TR/html401/struct/tables.html#h-11.2.3

    0 讨论(0)
提交回复
热议问题