Are You Deprecated?


| Comments (3)

Have you ever been deprecated? Well, I have. In fact, it happened just this weekend. Racing to get a Web page completed, I lost patience tweaking the CSS style I was employing to position an element correctly at several screen resolutions, in both Explorer and Firefox. So I slapped in a <center> tag and called it a day. I'm not proud of what I did. In fact, that very same legacy page contains more than a few stray <p> and <br> tags, not to mention a shocking number of border, width and even hspace attributes. Oh, the shame of it all.

There was a time not that long ago when I happily hand-coded pages in HomeSite using practices picked up in the 90's, oblivious of advances in Web standards. If something couldn't be positioned properly with a nice, nested <table> tag or two, then it wasn't worth positioning. An image needed to be moved down a tad? Well, that's why Tim Berners-Lee blessed us with the vspace attribute, right? Wrong. It now seems that for many years I totally misunderstood the true nature of HTML, which was to provide structure for a document by organizing it into identifiable elements, such as headers, sub-heads, paragraphs and lists. While CSS (Cascading Style Sheets) was the one true way for formatting these elements via styles collected within style sheets.

It actually makes perfect sense, when you think about it, especially when you get a sense of the advantages such an approach can bring both to your workflow and the quality of the layout. I avoided CSS in the early years partly because of the innate limitations common to any new specification. Then as it matured the issue became the lack of full or reliable support across platforms and browsers (insert sarcastic comment about Internet Explorer here). While it wasn't an issue for me, those using tools such as GoLive and Dreamweaver were less than thrilled about the degree of CSS support provided by such visual Web creation applications. But CSS has become increasingly more robust, the current generation of site creation tools is very CSS friendly and Explorer... er, well, it looks like the upcoming version 7 will finally make the CSS shortcomings of its predecessors nothing but a bad memory.

So if you haven't fully embraced the CSS religion, now is an ideal time to get the faith. And if you're still doing so, to finally renounce the use of HTML tags that the W3 in its wisdom has placed on its death list, to be no longer supported at some point. Tags that they poetically dub as "deprecated". Farewell compact, readonly and archive, we barely knew ye.

There's certainly no shortage of CSS tools or learning material. Beyond Adobe's offerings (or even Microsoft's Expression Web), you shouldn't overlook simpler applications that place CSS at the center of the creation process, such as Westciv's Style Master. If you're looking for third-party help getting up to speed, the Web itself is quite naturally awash in tips, tutorials and great examples of what CSS can do, most famously personified by the long-running Zen Garden site.

When it comes to books, I've been working my way through O'Reilly's recent CSS: The Missing Manual, by David Sawyer McFarland. Even though I've been using CSS for years, it's primarily been for much of the same thing and I've only tapped a fragment of what's possible. And along the way I've picked up a few bad habits, even resorting from time to time to the frowned-upon use of inline styles (shades of the <font> tag!). So my current project is to go back to ground zero and make sure I'm following good, standard CSS practices. And then to really grok the fancy stuff, so I can place elements with pixel precision. To that end, I'm curently finding The Missing Manual one of the better such volumes, for starters because it's very dense, something I value in tech books: the thing is packed with non-trivial examples, sidebars that actually contain useful information, lots of links to external resources, etc. The presentation is also very thorough: I think I finally really understand when to use relative versus absolute positioning. And the tip on how to use single-pixel GIFs is killer (joking).

The journey to CSS purity is a long one, and takes place one small style at a time. Yes, painful lapses are inevitable. But I have seen the light, brother, and will not rest until I have cast out the demon of deprecation. To create pages that are... not necessarily stylish, but beautiful.

Chris Dickman
Editor, Graphics.com

Technorati terms: ,

3 Comments

Hi, Chris,

I'm gradually moving over to CSS from years of using tables and font tags. However, I'm running into one situation where it seems like my CSS stylesheets just won't do what they are supposed to do: HTML-based e-mail newsletters. I'm creating and publishing these for several clients. I started out using a CSS stylesheet (internal, not linking to an external file), but I quickly found that my styles were only getting applied properly when the message was viewed in some e-mail clients; when the message was viewed in other e-mail clients (mostly web-mail interfaces), my styles appeared to be getting overridden by some other stylesheet. It looked like the stylesheet controlling the overall appearance of the web-mail page was also controlling the appearance of my HTML-based e-mail message displayed within that web-mail page. This often resulted in really ugly stuff! I read a lot of articles on CSS and tweaked and tweaked my stylesheet but could not solve these problems and got tired of the complaints from my customers. So I have gone back to tables for basic positioning and I'm guilty of inserting those pesky, deprecated font tags for controlling things like color, size, face, and boldness of text. This seems to be the only way I can guarantee that my HTML-based e-mail newsletters will look OK no matter which e-mail client the recipient is using to view them. If anyone has other possible solutions to offer me or any advice specific to formatting of HTML-based e-mail messages, I would be very grateful.

Chris Replies: I have to agree, email newsletters are the "final frontier" of CSS. I have been badly burned myself in this way several times and while I currently do use CSS for several newsletters, most of the code I have to confess is stuff worthy of 1999. That said, I am planning to make some experiments towards more modern layout practices, inspired to some extent by this now-old article on A List Apart. If readers know of more recent resources, feel to post them here.

Zoe said:

Regarding Theresa's comments: The problem with CSS in HTML email is not the fault or problem of CSS itself. Email clients *choose* not to support CSS -- and I agree with them. Some would argue that HTML should never have been put into email in the first place -- it certainly makes viruses and other malicious stuff so much more easy to transmit. CSS can also be used to transmit malicious stuff that people don't want to get through email, so it makes sense that email clients would severely limit it. My recommendation is to send plain-text emails whenever you can. If you must send HTML, keep it very simple. Email was never meant to be full-blown web pages, after all. For more information, see http://css-discuss.incutio.com/?page=StyleInEmail.

Chris Replies: Zoe, I'm not aware of any threat posed by using Cascading Style Sheets for formatting documents, could you point me to some examples? The only "CSS" I know of that is malicious is cross site scripting.

Bill Wood said:

Hi Chris -

Many of us started with "Design" WYSWG programs and are now starting to learn code. What advice can you offer designers who are caught between HTML and XHTML moving onward to CSS. Do young coders, including myself now begin at XHTML then CSS?

Chris Replies: Bill, it's not a case of one or the other. XHTML is just a stricter version of HTML and provides the document structure, while CSS makes it all look good. A good book like the one I discuss here can certainly help get you started.

Leave a comment