[Javascript] using CSS [WAS: Printing a Form]

Paul Novitski paul at juniperwebcraft.com
Sun Apr 8 02:03:18 CDT 2007


At 4/7/2007 12:17 PM, Del Wegener wrote:
>Perhaps you could point me to something (preferably online) less 
>than a full-blown course or text on CSS ( I have some of those) 
>where I could quickly and easily learn how to replace tables with CSS.

CSS is off-topic for this list, but here's a CSS listserve I heartily 
recommend:
http://www.css-discuss.org/mailman/listinfo/css-d

Their wiki has loads of great links:
http://css-discuss.incutio.com/

To get started using CSS to style lists as menus, check out MaxDesign:
http://css.maxdesign.com.au/


>I am not sure why everyone thinks tables are evil, I think they are 
>pretty slick.

It's not really that anyone thinks tables are evil, it's that tables 
are appropriate for marking up tabular data, inappropriate for 
marking up non-tabular data, and inappropriate for solving problems 
of page layout.  Matching the markup to the purpose or function of 
the content is called semantic markup and is slicker than slick, as 
in: the future of machine-parseable content.

Using a table to mark up a column of labels from a column of input 
fields sounds reasonable to me, but using a table to arbitrarily 
position two unrelated items side-by-side is like using a wrench to 
hammer in a screw.  Using tables to control layout is simply the 
wrong tool for the job -- and has some nasty side-effects, such as 
locking down the presentation in the HTML file instead of separating 
it out into the CSS file where it belongs.  Separation of HTML 
content from CSS presentation from javascript behavior makes for 
clean pages that are faster to write, faster to download, and easier to modify.

A dramatic illustration of this principle is the CSS Zen Garden 
<http://csszengarden.com/> in which a single HTML markup page is 
styled very differently by different people.  If the page were 
formatted in HTML with tables, this astounding variation simply 
wouldn't be possible.  Websites in the real world don't usually 
require this fantastic degree of versatility, but the reality is that 
many websites do get redesigned at some point by people who would 
prefer to spend less money and less time doing so.  Being able to 
tweak the content more or less independently of the styling has huge 
ramifications.

W3C: Separation of semantic and presentational markup, to the extent 
possible, is architecturally sound
http://w3.org/2001/tag/doc/contentPresentation-26.html


>What about menus like the one I used here
>http://www.edi-cp.com/topframeset.htm?/newsite/apps/apps_introduction.htm
>Can that be done better and easier with CSS ?

You can format the nested menu using CSS -- and without that very 
long loading delay.  The slow sliding behavior requires javascript or 
Flash or Java, etc.  Having the menu respond to a click event 
requires either a server-side script such as PHP or a client-side 
script such as javascript.

If I had to produce this particular menu I would mark it up as listed 
unordered lists and style it with CSS; I'd drive the menu with a 
server-side script that would work in the absence of javascript; and 
when javascript is running I'd use it to do the slidey bit, still 
using CSS for all the styling.  That approach is called 'progressive 
enhancement' and ensures that the

Regards,

Paul
__________________________

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 




More information about the Javascript mailing list