doushadu0901 2011-11-03 20:10
浏览 45
已采纳

2011年:DIV还是桌子? Div / Input / Labels仍然是可行的,还是XHTML Tables(tables / tr / td)的风格? [关闭]

DIVs or TABLEs?

Here's a question for front-end developers out there. Are table-less designs still required by most projects you work, or are simple tables structures accepted again? If so, were are tables appropriate? Data? Forms?

I recall, not more than a couple years ago, a designer friend of mine told me that I had to go table-less with all my HTML/XHTML. Everrrything tables. That DIV's were the way to go. Being more of a backend PHP/MySQL developer I tried to jump on the band-wagon with a CakePHP project or two. I revamped most of the basic template pages/structures to use DIV's with CSS2.

Now that I'm doing more CodeIgniter work... well, I'm now using tables with most of my Forms. I've had some issue with Divs. Tables are so much more structured and present me with less issues (IE6). Is this considered "bad code"? The company I'm working for has an image to withhold.

Thanks, Jeff

Edit: Please don't downgrade the question. It's a legitimate question from a non-designer needing to do front-end work. Maybe I should have asked , "Where is it appropriate to use tables in XHTML/CSS2?"

  • 写回答

1条回答 默认 最新

  • dongmimeng5500 2011-11-03 20:15
    关注

    a designer friend of mine told me that I had to go table-less with all my HTML/XHTML.

    Tables have one defined purpose: Tabular data. For that purpose, using them was never wrong. Using divs or other elements to re-build a table for tabular data is, was, and always has been a fine example of cargo cult programming - adopting something ("Eeeek, tables are evil!") without really understanding why.

    See this SO question for attempted definitions of what constitutes tabular data: Proper definition for "tabular data" in HTML

    What they should not be used for is layouting the page. That has really come out of style, and will probably never get back in style any more, seeing as they become less and less necessary as CSS improves.

    I personally find using tables for forms totally okay, by the way.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值