JavaScript GridView:TD VS DIV
最近我创建了非常基本的 GridView 实现。有一些问题,但没有一个是无法解决的。
但有一件事让我很好奇 - 哪种实现更好:使用 TD 元素还是使用 DIV ?
HTML 表格是一个非常基本的元素,它的发明是为了创建某种网格视图 - 表格。但另一方面 - div 元素 - 高度可定制的轻量级元素。
PS 我的目标是移动设备,结果布局必须包含尽可能少的元素。
UPD 这有点令人困惑,但我的 GridView 将作为列表中的一行放置:)
Recently i've created very basic GridView implementation. There were a few problems, but non of them is unsolvable.
But one thing make me curious - which implementation is better: with TD elements or with DIV ?
HTML table is a very basic element and it was invented to create some sort of grid views - tables. But on other hand - div element - highly customisable and lightweight element.
P.S. I'm targeting mobile devices and result layout must contain as less elements as it possible.
UPD It's a bit confusing, but my GridView will be placed as a row in the list :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果数据具有表格结构(即每个项目与同一行中的每个项目都有共同点(但与其他 ros 中的项目没有共同点),列也是如此),那么表格是正确的工具。否则,桌子就不是。
使用最能描述数据语义的元素(div 是最后的手段(并且不能选择具有不正确语义的元素))。
If the data has a tabular structure (i.e. each item has something in common with every item in the same row (but doesn't have that in common with items in other ros) and ditto for columns), then a table is the right tool. Otherwise, a table isn't.
Use the element that best describes the semantics of the data (with div being the last resort (and elements with incorrect semantics not being an option)).