Why CSS Matters – Living in The Petri Dish.

Petri Dish Article Graphic - Print, Web, CSS code

Taking Print content to the Web

Yes, it’s been months since I’ve posted here. And haven’t been that active in my Live Journal or Facebook pages either. The Studio’s been busy, folks. And have been shoving a number of projects through the house.  And when you’re a self employed Creative Pro, paid bookable hours trumps blogging. I had been tempted to rant on about the evolving throwdown between Adobe vs Apple vs Google (sort of) vs Mircosoft, centering around the mobile market, web standards, web video, HTML5 and Flash. But the simmering war of words, with flaming fanboy camps tossing off on each side has grumped me out, and it can wait.

So I decided to talk about some of the under the hood tech that makes contemporary web sites work, with a bit of diversion about bringing print content online.  I’m going to pitch this to the web user and business reader, so my fellow web pros will probably be bored to tears. But for the rest of you, we’ll demonstrate the main idea of the marriage of HTML and CSS by taking a look “backstage” with a print and web design project called, Living in The Petri Dish.

The past few years, over the winter I have been designing and Art Directing an annual calendar for an Interfaith Sanctuary, and in the 2010 Edition of the Wheel of the Year Calendar, I wrote a short Editorial Article for their Earth Living/ Earth Spirit section, focusing on global environmental, sustainability and climate issues. I wrote Living in the Petri Dish under my “spiritual” name, referring my Native American (among others!) Ancestry.

The Print Version from the Institutional Calendar

PDF

In times gone by, the most direct way to get print content online was to post a PDF version of the document. This is quite straightforward in layout tools such as Adobe InDesign, with a powerful export PDF function. But many applications, including Microsoft Office now have similar capability. In Mac OS 10, any document that can be printed, can be output to a PDF file. And here is the PDF version of the article. which is the print version of the Calendar Page. Depending on your browser settings and capabilities, the file will open in a new window, or download to your local drive. While PDF files preserve the formatting and structure of the original print document, and does not require the recipient to have the creating application, graphics or fonts, it does have some limitations for the web.

Web Coding, Old and Modern.

The “Old School” method of laying out a web page involved rather intricate coding, and creating tables to arrange elements on the page, like a mosaic, which were not their intended purpose. In more contemporary coding, the HTML page contains the content, and it’s information structure. And the display and presentation information is contained in a separate CSS style sheet. CSS refers to Cascading Style Sheets, which is a powerful method for marking up how a page is displayed. The main advantage is that you can have a separate style sheet for every page in a site, or just one for ALL the pages in a site. Or individual style sheets for unique elements, such as the home page, and a general one for the site’s content. The HUGE advantage is that if you need to alter an aspect of the site’s visual design, I make the change in the style sheet, and the change will appear in the entire site, or every page that accesses that style sheet. This is a much more efficient approach than painstakingly re-coding every instance of the design element in every page individually!

I recently had occasion to demonstrate the capabilities of CSS for a user group, in this particular  case, I took the SAME page, and used three different Style Sheets to radically alter the layout and appearance of the page. So let’s build a web page version using XHTML and CSS. As the author, I have the original text of the article, and was able to quickly code it into a basic web page, and collect some relevant links.

Coding HTML and CSS

The text is organized into paragraphs and headers. And I divided the page into logical sections using “Div” tags. Otherwise there is no layout markup.

Original images for the "Petri Dish" article.

I also had the original images used for the article, so I sized them for the web at 72dpi, and we’re good to go.

Take a look at the “pure content” version of the page, without any CSS Styling.

it’s all there, but it’s sooooooo  1998, and kind of boring.  So lets build a CSS Style sheet and connect it to my HTML document.

This is where the magic happens...

The highlighted code is where the HTML page refers to the CSS style sheet file that tells the browser how to display the page.

CSS file for the "BlueWhite Clean" version for the page.

The CSS that will style the Petri Dish article page.

A portion of the CSS file.  As you can see, I have started to define the look of the page. The overall typeface and size, background colors and the styling the headers. You can look at the full coding here, if you’re geeky and curious.

And the completed page now looks like this. Living in the Petri Dish.

As you can see, it’s much cleaner and feels more like a contemporary web page.

“Presto-Changeo”

But I am well aware that clients might want something different. So why not? I created another CSS document, and went back and changed just one line of the HTML to implement it.

<link href=”styles2.css” rel=”stylesheet” type=”text/css” />

I added some alternate graphics and the page takes on a radically different appearance.

Some clients might want a little more IMPACT… happy to make it “Pop”.

<link href=”styles3.css”…

I call this version “Hot Head Red”. It’s probably not the most tasteful design, but it was meant to show variation for the demo. Also for the sake of the demo, I added the navigation bar across the top to easily swap across the versions. Note that I’ve set the nav bar to pick up the link styling in the three versions.

Remember, no other code was changed in the HTML page other than the single line referring to the style sheet. Now there are a few caveats, older versions of some browsers have uneven support for CSS, most notably Internet Explorer Version 6 which handles CSS in a non-standard manner. But modern browsers support CSS very well. IN the near future, we’ll be seeing the deployment and support in browsers of HTML 5 and CSS3 which will bring additional enhanced capabilities and features.

Links

Living in the Petri Dish variations:
No Styles
BlueWhite Clean

GreenWorld
HotHeadRed

PDF of Print Version

Four Quarters Interfaith Sanctuary
Earth Living~Earth Spirit Complete Supplement (PDF)
Union of Concened Scientists
Rolling Stone: As the world Burns
Rolling Stone: The Climate Killlers
UCS: “It’s Cold and My Car is Buried in Snow. How Can Global Warming be Happening?”

One thought on “Why CSS Matters – Living in The Petri Dish.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.