September 29, 2004

A Hard Freeze Would Kill ’em

I’ve been mopping the floors tonight. I fixed a display issue in my previous entry, that was blowing up my blog index in a web browser that despite widespread popularlity, I choose not to use. I also cleaned up the navigation on the left, removing a few things that I felt inessential. The Weblog archives are still accessible through a link at the bottom of the index, and the Coolio archives can be accessed by clicking the Coolio header. Neat stuff.

I also added some color to form elements, cleaned up the contact page, and made some slight changes to contrast here and there to enhance legibility. Ya’ll probably won’t notice most of it. I spent the evening nursing a bad case of code head, which I resolved by going for a long run with Shane.

"Do you know what Roundup is?"

"Of course I know what Roundup is. I had an entire gallon of Roundup at my old place."

"That’s a lot of Roundup."

"I mixed it in a shallow pan with some milk, and left it out for stray cats."

"Why didn’t you just set out some anti-freeze?"

"Everyone suspects the anti-freeze. No one suspects the milk."


Two Columns, Quick and Dirty in CSS

I have seen many solutions for creating tableless, two-column designs in CSS, but most of them lack in one way or another. Either they are static width when I’m looking for liquid, or liquid when I need static, and often times if the code isn’t sufficiently tortured, they don’t even achieve the look of the two-column design. You know the look I’m talking about. It’s the one where both columns appear to be the same length. You have one in front of you right now.

How did I do this? First off, let’s work backwards. Assume that I have no solution to the CSS two-column design, and instead let us start with a sensible, semantic structure for our XHTML code. Let us take this logical, flexible and reusable block of code, and see how we can make it work as a two-column design.

Here is the code structure we will work from, free from any style whatsoever. We see all the familiar elements of any basic website: header, footer, content area, and primary navigation. For the most common applications, there’s hardly any more structure you need. How to go about designing it, then?

The first thing I always do when starting a new design is zero my margin and padding styles for every single HTML element, so there is no ambiguity about how the browser should treat spacing. Each browser has its own idea on how much padding to apply to a paragraph tag, how much to use for indenting a list item, and since I am a control freak, I prefer to manually define all my styles. This leaves no room for subjectivity on the part of the browser, and I know that any errors in rendering are my own. So, I always start with the following CSS:

* {

margin: 0;

padding: 0;


See the result. Ain’t that beautiful? Every single browser I have tested plays by this rule without any need for hacks.

Next, let’s center a box in our page that will contain all our content. The name I have always used for this outer block is “Whopper”, and the whopper always wraps around all my other elements, including the header, footer, content and navigation areas. You can call it anything you want; something that makes more sense or less sense, depending on your personal coding style.

body {

text-align: center; /* this centers the whopper in IE */


div#whopper {

width: 700px;

margin: 20px auto 20px auto; /* this centers the whopper »

in compliant browsers */

text-align: left; /* this returns alignment to normal */


Now, according to the W3C’s CSS spec, the only thing we should need to do to center our whopper is to give it a width (so it knows what size element is being centered) and declare “auto” on our left and right margins. However, Internet Explorer ignores auto margins, so this won’t work as a complete solution. Fortunately, Internet Explorer will (wrongly) center block level elements if their containing element declares {text-align: center;}. So that is what we do, and our result is thus (with some color to help differentiate areas).

Now, let’s make our headers and footers take up some space:

div#header {

height: 25px;

background: #9EA671;


div#footer {

height: 50px;

background: #9EA671;


Check it out. Depending on your browser, you may be witnessing another hang-up, here. As we discussed earlier, Internet Explorer improperly treats the height property like min-height, and will stretch an element if the stuff it contains is bigger than the element itself. Thus, even though we declared a 25 pixel height on our header, the default font size for the h1 tag is taller than 25 pixels, and is pushing out the height of our header. This problem does not affect compliant browsers, as they properly overflow content that doesn’t fit.

The best way that I have found to fix this problem is to simply be disciplined in what you put in boxes with static heights. Make sure you don’t try to jam a giant squid in your refrigerator. This is what we will do:

div#header h1 {

font: bold 15px/1.2em arial, helvetica, verdana, sans-serif;

color: #C0C69F;

text-decoration: none;


And this is the result. Next, let’s position our navigation and content areas so they are next to each other:

div#content {

float: right;

width: 500px;

background: #97A199;


div#nav {

width: 200px;

float: left;

background: #7F9794;


div#footer {

clear: both;

height: 50px;

background: #9EA671;


There we are. We have given the navigation area a width of 200 pixels and have floated it to the left. This can cause the content area to do any number of things that we don’t want it to do, like have its text reflow around the navigation area, so we do the same thing to it on the right side. Finally, to keep the footer from trying to bunch itself up in whatever space is available between the navigation and content, we clear both floats so it always flows to the bottom.

Again, we didn’t need any hacks to get this to work in nearly all modern browsers, but I have taken a few preventative steps to avoid potential problems. IE5.2/Mac adheres to the CSS spec very closely when it comes to floats and widths, and will choke if you assign a float to an element without also giving it a width. Most browsers are much more forgiving, but you can save yourself a few headaches by taking the extra step.

Also, flow control seems to be a problem when floating elements in some browsers. Whenever I plan on floating an element to the right, I always make sure that in my HTML code, that element comes before the content that will appear on the left. Too often I will float an element to the right of something, only to have it appear below the content I wanted it to be next to. This is the reason our content element (which floats right) appears before our navigation element (which floats left) in the HTML code for our template.

There are other semantic arguments about why content should appear above navigation in the code flow, or why everything should be absolutely positioned so the code flow has no effect whatsoever on content order, but these considerations are beyond the scope of this tutorial. Again, these are preventative decisions I make when coding a design. Some superstitious people have a lucky horseshoe, others have a lucky rabbit’s foot, and me, I have a lucky code flow.

Now comes the fun part. A major wrankle for many people getting their feet wet in CSS is that it’s impossible to simulate a two (or more) column layout without resorting to tables. I myself was fairly convinced that this was the case, until I reexamined what it was I really needed to accomplish.

Notice how the background on our navigation element falls far short of filling up the column next to the content area. I had always approached the problem by looking at these two areas (in our case, the navigation and content areas) as columns in a table. How can I get this area to be the same height as the one right next to it, even though it doesn’t have enough content to push itself to that height? More dead content? Images that are 6000 pixels tall? Scripts that dynamically write height values? What?

I had all but given up, having decided that this ugliness was just another thing to work around with CSS designs, when it suddenly hit me that I was going at it all wrong. The solution had nothing to do with the elements in question, but with their containing element. The containing element runs from corner to corner of the entire area I want to columnize. If I could somehow give it a background that looked exactly how I want my columns to appear… Eureka.

Let us then use our containing element, the Whopper, to create our two column design. We will need to create one image which will serve as the repeating background for the entire whopper area. Mine is 700 pixels wide, 10 pixels tall, and looks exactly as you would expect. We write the following code:

div#whopper {

background: #C0C69F url(dirty_whopper_bg_01.gif) top left repeat-y;

width: 700px;

margin: 20px auto 20px auto;

text-align: left;


div#content {

float: right;

width: 500px;

/* background: #97A199; */ /* no longer necessary */


div#nav {

width: 200px;

float: left;

/* background: #7F9794;*/ /* no longer necessary */


Whammo. Two columns that automatically fill up the dead space with color.

Now that we're done with the hard stuff, we can actually start to have some fun with this design. Fun will have to wait for another time, however, as this designer is plum tuckered after racing the neighborhood kids all evening on Big Wheels and girlie bikes.

September 27, 2004

Anti-Narcoleptic Transient

Bike Crank

Alright, kiddies. Gather ’round as uncle Dane tells another story from his musical ass. First off, we’ve cooked up two new photo galleries tonight, one from May when I went to Yachats, Oregon to play on the coast for a weekend, and another from the String Cheese Incident music festival at Horning’s Hideout in June. Enjoy.

Today I turned over the keys to Lava House, so now someone else gets the opportunity to drive our old digs around for awhile. I told the property manager that while the bay windows have great views, especially in the winter when the Elm on Nightmare Street is bare, and the off-street parking is delightful, and the house has a lovely indoor breeze when you open up the front and back doors, and the fireplace makes you cozy and the lukewarm showers make you rugged, the key renting point of this property is none of the above.

No, with the neighborhood becoming overrun with yappy dogs and stray cats and construction sites and drunk traffic, there are two reasons why someone should want to live at Lava House:

  1. It is within stumbling distance from all the downtown bars
  2. When the McMenamins across the street opens in November, it will be within wheelbarrow distance from that

Funny thing is, I don’t particularly miss Lava House. Since leaving for college in ’99 I haven’t lived in any one place for more than six months at a time, and having lived there for nearly a year, Lava House has been my most permanent residence since childhood. Erik moved out in August and it was fun spending most of September rattling around my own place, but really, without the soul of the occupants, Lava House didn’t have much of a soul at all.

Lava House does mark a point where I needed to flesh out my belongings beyond what I can reasonably carry on my back. Through college and into my exodus to Hood River, I have typically tried to cull my belongings to only the reasonable necessities; that which I can dump at the cabin in trips to visit the folks, or just enough that I can stuff in my car and still live for an undetermined amount of time, 1,600 miles away from familiarity.

I knew I needed to buy a mattress when I moved into Lava House, and for nearly two weeks I resisted, spending nights in my sleeping bag on the floor in my room. I finally broke down and got one, and felt absolutely sick about my sudden loss of mobility. If it wasn’t for the fact that the mattress salesman was the nicest grandfather in the world, I don’t think I would have survived.

But I did, and through subsequent trips to the Goodwill I built myself a frugal living environ. A computer desk for $40. A night stand for $8. A dresser (which is actually a piece of office furniture with locking drawers) for $20. A computer chair for $2. Thanks to Goodwill I’m one step up from the plywood and cinder blocks of college. Up, but not too far up, and I like it that way. I enjoy knowing that if it comes down to it, I can give all my large objects to the goats, hit the open road, and only be out a couple hundred bucks. I hate moving. I’ll throw everything away before I’ll go through the trouble of moving it.

I have accumulated other things, however, that I would not be comfortable parting with, and they are the things that allow me to pursue the hobbies that I enjoy. A computer or three, a bass guitar and amp, a bike, a new kite, a Subaru. None of these are ends, but means. They are merely enablers. Pretty freakin’ rad enablers at that, but enablers nonetheless.

If there’s one thing I hate more than moving it’s unpacking, and that’s where I’m at right now in my new place. I’m at a point in my life where I still starve for agility, and I hate looking at all these boxes of junk. Each one is an anchor. If I take the time to unpack everything I can fill up my shelves and make it look like someone lives here, but then again I’m just going to need to pack it all up in a few months and shove it to a new corner of the globe.

What a pain. Sometimes I wish a wildfire would just come along and burn it all away so I wouldn’t have to worry about it anymore, and then I could worry about something new like third degree burns and lost social security cards and stuff.

Then again, maybe I’m just extremely tired and stressed from moving, and I need to lighten up, get some rest, drink more beer, and go clubbing. If it comes down to it, I can always put everything in the front yard with a free sign. Or better yet, a $20 sign. Cuz if it’s free people will think there’s something wrong with it, like it smells like pee or something. But if it costs twenty bucks, people are much more apt to buy it.

Or better yet, steal it.

Too Much Heaven

We’re back online. I’m just gonna jab my fingers at the keyboard for a few minutes, because that sort of thing helps my mind shuffle things back into place. I’ve been wiggin’ out for the last couple weeks and there is much to say and many plans afoot, but I can hardly lay into those right now. It’s midnight, I work tomorrow, and I’ve gotten a total of eight hours of sleep this entire weekend.

Been busy. The Jack Johnson and G. Love concert was lovely but way more mellow than what I was expecting, so I spent a good part of the show making up games for myself… like playing the “shell game” with the stage lights, making shadow puppets with the moon shining on someone’s back, and telling stories about napalm attacks at outdoor music festivals.

We dug trenches for the sprinkler system at our new house. Shane borrowed the trencher from his work, which chews and spits out rocks and legs without discrimination.

I finally got all my crap cleaned out of Lava House, and I’m looking forward to the fact that I will never need to park under that elm tree again. I parked under it for a mere two hours yesterday, and not only did it fill up my car with its sickly yellow leaves, but the birds sitting in it managed to fill up my car with crap.

I switched the email client on my home computer over to Thunderbird, which was great except that the message filters don’t seem to execute properly on the local folder. In trying to get everything to work, I accidentally deleted all of my mail from the last month. I do have backups at work, though, and Thunderbird imports and exports existing mail easier than any Microsoft product I have ever used.

I finally got Apache Server working on my Windows computer, and I have it set up with PHP in a development environment. Now I am able to execute and test all my PHP scripts locally, before uploading them to a live site. I brought down a tarball of Brainside Out and blew it up under my Apache web server, so now I have a fully functioning local copy of my website that I can build and maintain, and push live whenever I am satisfied with my changes.

After a lot of trial and error, I got Slackware Linux installed on my old computer. Once I figure out what I’m going to do with Linux, I’m gonna need to learn how to do it with Linux. Right now the installation is more a proof of concept than anything else, as my l33t l1nux 5k1llz are exhausted by ‘ls’ and ‘cd’.

I know how to view a file in vi, but I can’t figure out how to quit vi without mangling the file beyond recognition. I am sure to spend a lot of time in Linux working as a user with very, very limited access. If you don’t understand my frustration with Linux, think of trying to paint landscapes along with that guy on PBS. While wearing oven mitts.

More later.

September 21, 2004

Better than Matching Sweaters

Rumor has it that internet access at our new house will be installed this Friday. My original plan was to sniff the air and borrow a neighbor’s unsecured wireless connection, but no one in our neighborhood appears to be that tech-savvy. Currently we have:

  • The 80-year-old man who loves working in the yard
  • The woman with an SUV that looks suspiciously like a sex toy
  • The kids who drive their Jeep Cherokees 50 feet down the street to hang with their friends
  • The fellow who wears red and yellow Zubas and says goodbye to his wife every morning at 7:45
  • The cop
  • The ugly kid
  • The chickens
  • The goats
  • The dog that will tear your face off
  • The bright pink ski suit

I’ll be at the Jack Johnson and G. Love concert Friday night, so we won’t be returning to our irregular updating schedule until this weekend.

September 13, 2004

Put Yer Foot Down: A Vacuum Tube Solution

One of the nicest things about using HTML tables for design was that they made it painfully easy to create a multi-columned layout with a header and footer. Building a multi-column design using pure CSS has been welldocumented in many places, but I’ve found that many CSS designs lack one attractive feature of tables: the Minimum Height, Auto-Stretching Vertical Content Area.

In these designs, the content area stretches when there is too much stuff to fit on one screen. Even when there was little or nothing on the page, the content area still retained a minumum height, keep things from feeling all squashy on sparsely populated pages.

In a perfect world, the ideal solution is to always author enough content so that you never end up with a page so devoid of meaning. In the real world we need a solution, a vacuum tube solution, with a content area that will hold its space no matter how little it contains. Maintaining a minumum height was easy with tables, but can be a bit tricky with CSS.

First, let’s look at an example CSS layout. It looks pretty nice, but it feels smooshed when we remove all but a smidgen of content.

CSS conveniently provides us with the min-height property, which would be a complete solution if it weren’t for a particular browser that doesn’t play the game. For now, check it out:

div#content {

min-height: 400px;


No matter how much content is in the content area, it will be at least 400 pixels tall, flesh out your page and push your footer to the floor. If there is a ton of content, the area will stretch vertically to accomodate it. This rule works in fully-compliant browsers, but will be completely ignored by IE. Internet Explorer does not support the min-height property, and actually treats the height property like min-height. Consider the following:

div#content {

height: 400px;


This will be read by IE, but it will be interpreted as though it is the min-height property. In IE, the content area will be at least 400 pixels tall no matter what, and will stretch if there is more content than the space can handle. This is a pretty major wrankle with IE, as the CSS spec says that any block-level element with a height explicitly defined should never be allowed to stretch (or squash) beyond (or below) its defined height.

Fret not. We can do it anyway, and it only requires one minor trick:

div#content {

height: 400px; /* defined here for IE */

min-height: 400px;


html>body div#content {

height: auto; /* for compliant browsers, ignored by IE */


IE will read the first height (treating it like min-height), but it will ignore the min-height. Since IE/Win doesn’t support child selectors, its height will not be reset by the { height: auto; } rule. Browsers that support child selectors will read the first height and the min-height, but will have their explicit height reset by { height: auto; }. No longer having a height defined, they will correctly use the min-height property, which is exactly what we want them to do.

Yes, it is that simple. Check it out with tons of content and mere scraps of content. This technique has been tested and proven in the following browers:

  • IE 6.0/Win
  • Opera 7.54/Win & Mac
  • Mozilla 1.7.2/Win & Mac
  • Firefox 0.9.3/Win & Mac

It doesn’t work in Safari 1.2.3, which correctly handles the height property but doesn’t support the min-height property (yet). It also doesn’t work in IE 5.2/Mac for the same reasons. Fortunately, this technique degrades gracefully in both these browsers, as they both correctly parse the html>body child selector and have their explicit heights overwritten by the { height: auto; } rule. Thus, we avoid any carnage resulting from overflow problems, and you simply don’t get the neatness of minimum height on pages with thin soup. Perfect.

P.S. There has been talk of using the CSS table-cell property to spoof minimum heights, but using it results in some pretty gnarly display issues in IE 5.x/Mac. There are CSS hacks one can use to show/hide this information from IE/Mac, but the aesthetics of using height and min-height outweigh my desire to exploit the table-cell property.

Anyways. Go warm up your vintage amps and start rockin’!

September 8, 2004

Drunken Beer-Fest Tonight!

Just a reminder that there’s a Bend Blogger Bash tonight at Cascade Lakes Brewery. Everybody sez they iz gonna be there around 6:30. Bring a paint ball gun and a sack of oranges, and be ready for drunken pool and geek shouting matches.

This reminder is more for myself than anyone else, as this site is hardly an informational nexus for the hottest goings-on in Bend. I mean, since it revolves around me it obviously references the hottest happenings in the multiverse, but not necessarily those local to Bend.


September 3, 2004

Light Winds out of the West

Updates will be light over the coming weeks. Erik the Great has moved out of Lava House, and since I’m moving out this month we pulled the house off the network. No cable. No internet. I’m a happy little island of oblivion until I move into my new place, where chickens run around in the street and I can see goats from my bedroom.