Why is using tables for website layout such an evi

2019-01-14 12:21发布

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'?

14条回答
地球回转人心会变
2楼-- · 2019-01-14 12:45

I highly recommend reading the book Designing with Web Standards. It suits designers, developers and people with a more business oriented role.

查看更多
Ridiculous、
3楼-- · 2019-01-14 12:46

The idea is that marking up the content/meaning of the page is a better thing to do, not just because it makes it easily modifiable and styleable but also (possibly more importantly) because it improves accessibility, for those using screenreaders, etc (and for search engines!). Read Dive into Accessibility sometime. [And if you have tabular data, you should use a table of course.]

Although "try to use CSS, not tables, for layout" is a very important rule that you should try to follow as much as possible, ultimately, "doing the right thing" has some cost, and when it gets too high, you should reconsider your priorities. See http://giveupandusetables.com/

查看更多
爷、活的狠高调
4楼-- · 2019-01-14 12:46

This may not be right on the topic but the most frequent problem I have with CSS layouts is that they can be difficult to set up so that they always stretch the parent node instead of just overflowing it. This becomes even bigger pain when you hit one of the not very rare instances of IE doing something completely different than FF. Fixing this mess with a table is usually easier and more compliant than various JS workarounds you would be otherwise forced to use.

查看更多
ら.Afraid
5楼-- · 2019-01-14 12:47

Honestly, don't worry that much about using tables. Even some of the best, most semantically correct people advise using tables if it's easier for the flow of the document. Just use what works for - the dissadvantage to using tables isn't all that great.

查看更多
走好不送
6楼-- · 2019-01-14 12:48

With support for newer CSS display properties in IE8, this debate about tables vs CSS might soon end. Since it's easier and sensible to think of layouts in the grid/table format, the availability of table, table-row, table-cell, table-caption, table-column, table-row-group, etc, as CSS properties will ease layout implementation significantly.

This article has a detailed overview.

查看更多
Animai°情兽
7楼-- · 2019-01-14 12:50

There's a pretty good article on sitepoint which puts designing a page in tables vs css head to head. It's a pretty interesting read and highlights some of the major pitfalls for the designer / developer when using tables such as mangled source code with tables, extra source code is often required and future changes are inevitably complicated.

查看更多
登录 后发表回答