表格或清单:我应该在这里使用什么?

时间:2022-09-10 23:31:08

I would like to know which tags I should use for layout like this. Semantically is both a table and a list to me. How I can achieve those underlines and keep the markup right?

我想知道我应该使用哪些标签进行布局。在语义上对我来说都是一个表和一个列表。我如何能够实现那些强调并保持正确的标记?

表格或清单:我应该在这里使用什么?

4 个解决方案

#1


6  

I would personally use an ordered list to achieve this, the sub list under Suma skladki means it isn't really tabular data.

我个人会使用有序列表来实现这一点,Suma skladki下的子列表意味着它不是真正的表格数据。

This link should give you EXACTLY what you need:

此链接应该为您提供所需的一切:

http://thepcspy.com/read/css_table_of_contents/

#2


3  

To me personally, this looks more like a list than a table (though you could still construct it as a table, and do so justifiably). I would construct it as a nested list.

就我个人而言,这看起来更像是一个列表而不是一个表(尽管你仍然可以将它构建为一个表,并且这样做是合理的)。我会把它构建为嵌套列表。

<ul>
  <li>Suma skladki <span class="price">900 PLN</span>
    <ul>
      <li>Skladka podstawawa 
          <span class="desc">(dia przychodu 250 000 PLN)</span> 
          <span class="price">550 PNL</span>
      </li>
    </ul>
  </li>
</ul>

This will also give you more design flexibility in the future than if you use a table element. I'm not so sure a table communicates the nested hierarchy that you have here as well as a series of lists either.

与使用表格元素相比,这将在未来为您提供更多的设计灵活性。我不太确定表是否传达了您在此处的嵌套层次结构以及一系列列表。

#3


1  

That looks like tabular data so a table would be semantically correct

这看起来像表格数据,因此表格在语义上是正确的

#4


1  

  • Just because you have sub-data, does not mean it's a list; there are plenty of tables that have subcategories (just look at a general ledger)
  • 仅仅因为你有子数据,并不意味着它是一个列表;有很多表有子类别(只看一般总账)

  • You have multiple pieces of structured information, arranged in a consistent way, which constitutes a table, or tabular data
  • 您有多条结构化信息,以一致的方式排列,构成表格或表格数据

  • What you're showing above is the equivalent of a TOC (Table of Contents) and it's a table for a reason (you have a label and a value)
  • 您在上面显示的内容相当于TOC(目录),它是一个表格,原因(您有标签和值)

That being said, this day in age it doesn't really matter what you use as long as you can defend it, especially since lists/divs can take on the shape of a table.

话虽这么说,但只要你可以保护它,这个时代就没关系你使用什么,特别是因为list / divs可以呈现出桌子的形状。

It's more improper to use a table for something that is not a table, than to use a list for something that could use a table.

将表用于不是表的东西比将表用于可以使用表的东西更不合适。

#1


6  

I would personally use an ordered list to achieve this, the sub list under Suma skladki means it isn't really tabular data.

我个人会使用有序列表来实现这一点,Suma skladki下的子列表意味着它不是真正的表格数据。

This link should give you EXACTLY what you need:

此链接应该为您提供所需的一切:

http://thepcspy.com/read/css_table_of_contents/

#2


3  

To me personally, this looks more like a list than a table (though you could still construct it as a table, and do so justifiably). I would construct it as a nested list.

就我个人而言,这看起来更像是一个列表而不是一个表(尽管你仍然可以将它构建为一个表,并且这样做是合理的)。我会把它构建为嵌套列表。

<ul>
  <li>Suma skladki <span class="price">900 PLN</span>
    <ul>
      <li>Skladka podstawawa 
          <span class="desc">(dia przychodu 250 000 PLN)</span> 
          <span class="price">550 PNL</span>
      </li>
    </ul>
  </li>
</ul>

This will also give you more design flexibility in the future than if you use a table element. I'm not so sure a table communicates the nested hierarchy that you have here as well as a series of lists either.

与使用表格元素相比,这将在未来为您提供更多的设计灵活性。我不太确定表是否传达了您在此处的嵌套层次结构以及一系列列表。

#3


1  

That looks like tabular data so a table would be semantically correct

这看起来像表格数据,因此表格在语义上是正确的

#4


1  

  • Just because you have sub-data, does not mean it's a list; there are plenty of tables that have subcategories (just look at a general ledger)
  • 仅仅因为你有子数据,并不意味着它是一个列表;有很多表有子类别(只看一般总账)

  • You have multiple pieces of structured information, arranged in a consistent way, which constitutes a table, or tabular data
  • 您有多条结构化信息,以一致的方式排列,构成表格或表格数据

  • What you're showing above is the equivalent of a TOC (Table of Contents) and it's a table for a reason (you have a label and a value)
  • 您在上面显示的内容相当于TOC(目录),它是一个表格,原因(您有标签和值)

That being said, this day in age it doesn't really matter what you use as long as you can defend it, especially since lists/divs can take on the shape of a table.

话虽这么说,但只要你可以保护它,这个时代就没关系你使用什么,特别是因为list / divs可以呈现出桌子的形状。

It's more improper to use a table for something that is not a table, than to use a list for something that could use a table.

将表用于不是表的东西比将表用于可以使用表的东西更不合适。