为什么要使用表格来进行网站布局这样的恶魔 [英] Why is using tables for website layout such an evil

查看:118
本文介绍了为什么要使用表格来进行网站布局这样的恶魔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名Winforms和业务引擎开发人员,他在两年多以来首次使用asp.net,并且在那段时间我已经注意到一些约定的变化。



反布局运动背后的逻辑是什么?



是否允许使用css类来处理布局,如果是这样,如果这确实是一个页面上的问题,你肯定会保持静态,或者它只是被认为是丑陋的? 解决方案

还有一些要点:


  • 不要太狂热。 CSS并不完美,有些事情可以通过表格更容易地完成。所以如果你需要的话,在那里放一张小桌子。它不会杀了你。
    基于表格布局的主要邪恶是一种深深嵌套的混乱,曾经是唯一的方式精确控制页面。您可以在表格内的表格内放置表格,并在战略上放置透明图片以控制间距。我认为现在这种情况非常罕见,CSS可以让你清理这个混乱的90%。

  • 给页面赋予意义,而不是描述布局,是一个不错的目标。但是,目前的HTML版本并没有达到这个目标。因此,您的网页上总是会有足够的标签用于布局,没有其他含义。这并不意味着你不应该尽量分离内容和布局,它只是意味着你不会100%。

    I am a Winforms and business engine developer who is using asp.net for the first time in over 2 years, and in that time I have noticed a few convention changes.

    What is the logic behind the anti-'tables for layout' movement?

    Is it to allow css classes to be used to handle layout, and if so, should this really be an issue on pages you are fairly sure will remain static, or is it just considered 'ugly'?

    解决方案

    A few additional points:

    • Don't be a fanatic about it. CSS isn't perfect, and there are some things that can be done much easier with tables. So if you need to, put a little table in there. It won't kill you.

    • The major "evil" of table-based layouts was the kind of deeply-nested mess that used to be the only way to get precise control over the page. You would have tables within tables within tables, and transparent images strategically placed to control spacing. I think this is pretty rare nowadays, and CSS will let you clean up 90% of this mess.

    • The "semantic web", where tags are there to give meaning to the page, not to describe the layout, is a good goal. However, the current version of HTML doesn't go very far toward reaching it. As a result, you will ALWAYS have plenty of tags in your pages that are just there for layout, with no other meaning. That doesn't mean you shouldn't try to separate content and layout as much as possible; it just means you won't get there 100%.

    这篇关于为什么要使用表格来进行网站布局这样的恶魔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆