Tuesday, October 23, 2007

Internet Police, Part Three

KompoZer may be one of the few WYSIWYG editors to produce valid code. KompoZer does not generate the proprietary nonsense found in the output of some editors. Mark up generated by KompoZer passes W3C validation and tools like HTML Tidy usually find little to complain about.

This post is part three in a series about using tables to control web page layout. I maintain using tables is a viable alternative to mastering CSS for novice authors.

Producing valid code, as mentioned in other parts of this series, is one of those things that we should do to be responsible web authors. There are quick and painless ways to test your web pages and make them accessible to all visitors.

W3C Mark Up Validation

W3C, the World Wide Web Consortium, isn’t something new nor are their standards. Current HTML, CSS and accessibility standards date to the late 90’s but even after a decade standards are not fully implemented by web authors and browsers. Many “professional” pages I have tested don’t make it through the HTML or CSS validator available from W3C and others. You can prove that assertion by testing pages you visit.

W3C is very clear about what a “valid” rating means from their validator. Your web page is tested based on the document type definition (DTD) presented and if “…a document actually follows the rules for the language(s) it uses… [it] is called valid”. A valid page may not have good code but it is likely that modern browsers will be able to present your page more or less as you intended. Even if I don’t use good English you know what I mean. It is the same thing with mark up and browsers.

Creating pages that are valid as defined by W3C doesn’t necessarily mean that Firefox and Internet Explorer will splash identical images on your screen. Firefox will probably look like your KompoZer preview; Internet Explorer behavior is another subject. If the mark up is valid then it is likely that your visitor will see the page “kind of” like you intended with any modern browser. Running your page through the W3C Validator is the least you can do to be a responsible web author. If you use CSS there is a separate validator.

Are Tables Valid?

HTML tables on the web come in two varieties, layout tables and data tables.
There is no question that the vast majority of tables on the web are layout tables, used to structure the visual appearance of the page. Often the structure of tables is remarkably complex, with tables nested in tables as much as seven deep.
I’m not sure if nesting tables seven deep is a good idea or valid by W3C criteria but generally tables are both valid and accessible if done right.

My first web authoring project was little more than a year ago. The project was initiated with Nvu and finished with KompoZer. Each page, 60 total, was based on a table layout. Each page was valid when I was ready to publish according to W3C.

Since those initial validation tests I have discovered a couple of other sites for validating HTML mark up. Page Valet is one of them and Validome is another. I’m not sure if there are any differences in the criteria or the way criteria are applied. Occasionally W3C Validator is not available so I use these alternatives. Test your pages. The resources are free.

The Next Step: Accessibility

Here are some of the major points, made by others, regarding the use of tables for controlling presentation:

Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media.”

“…web browsers that are not capable of rendering standards as intended. Some browsers, for example, still have trouble rendering CSS. Explorer remains the worst at rendering CSS as judged by World Wide Web Consortium standards…”

“[This Site] …is built using tables, and until browsers that support CSS Positioning are more widely used...”

So it seems we have another catch 22 with the issue of using CSS for layout. W3C says we should use CSS rather than tables but browsers have trouble presenting CSS. I can’t tell you the number of times I thought I mastered a CSS layout only to have it break in a browser. Folks who profess to know what they are doing lament that CSS they offer to novices breaks when exposed to things like Internet Explorer. Other experts offer ‘hacks’ to get the desired interpretation.

Rather than messing with CSS and hacks I’ll stick with tables for now just like Wal-Mart and a lot of other folks. For my “public” pages I’ll make sure the content is both valid and accessible. Here’s what others say about tables and accessibility:

You will probably hear some accessibility advocates say that layout tables are a bad idea, and that CSS layout techniques ought to be used instead. There is truth in what they say, but, to be honest, using tables for layout is not the worst thing that you could do in terms of accessibility. People with all kinds of disabilities can easily access tables, as long as the tables are designed with accessibility in mind.

Screen readers essentially ignore the fact that the content is inside of a table. The screen reader just reads the content in the literal order that it appears in the code. If the literal order of the content in the code is logical, then your linearized reading order is logical.

Consider this to get your head around the accessibility issue: My home is not fully accessible and that is generally not an issue. I did have a friend who used a walker so he could not visit my home. If this were a business, the house would need to be accessible to all who may visit whether their limitations are physical, visual or auditory. In the case of a fire someone who couldn’t see would need to hear an alarm. Someone who couldn’t hear would need to see the alarm. Someone in a wheelchair would need an egress path wide enough to accommodate the chair. Our web pages should address the same kind of issues if they are “public.”

There are good places to start to develop an awareness of accessibility issues. Other sites have useful how to instructions. The idea is to be aware of how your site will be used by your visitors. A broad audience and certainly a commercial site will require more thought than a site for friends and family. Even then it would be good to test your site to see how well you have complied with the letter and intent of accessibility laws. Web authors, even novice web authors, should produce accessible pages.

By using KompoZer is relatively easy to produce a site that is both valid and accessible. Clearly those sites can use tables, which for us beginners more easily understood than Cascading Style Sheets. Faced with the option of not having a novice author’s page on the web or having it with a table layout, I’ll take the table every time.

Wysi

; .

0 comments: