Sep 12 2008

Pin Your Footers The CSS Way

Category: Programming, Tutorialsstephen @ 7:59 am

I have been using a new CSS tech­nique for cre­at­ing fixed foot­ers – that is, foot­ers which pin them­selves to the bot­tom of the browser win­dow – with­out using JavaScript. Head­scape designer Ed Mer­ritt is the one who came up with the idea, and like most ele­gant solu­tions, this one is so sim­ple that I wish I’d thought of it. It really works.

Assum­ing your basic HTML lay­out markup looks like below:

1
2
3
4
<div id="container">
  <div id="content"></div>
  <div id="footer"></div>
</div>

… you can use the fol­low­ing CSS exam­ple to pin your footer:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#container {
  position:absolute;
  min-height:100%;
}
 
#content {
  margin-bottom:100px; /* same as footer height */
}
 
#footer {
  position:absolute;
  bottom:0;
  height:100px; /* same as content margin-bottom */
}

So, hack away. It’s not suit­able for every design, of course, but it just might help you get rid of that annoy­ing white­space below your footer, for instance on a content-starved page which ends up far short of the win­dow height.

Tags:


Apr 02 2008

Installing nginx and PHP with FastCGI on Mac OS X 10.5 (Leopard)

Category: Tutorialsstephen @ 9:04 am

These are instruc­tions for how to install nginx (pro­nounced as “Engine X”, a high-performance open source web server) and PHP with FastCGI on a Mac for devel­op­ment pur­poses. I spent quite a bit of time fig­ur­ing out how to do this on my own, so hope­fully it will save some­one else a lit­tle time. For the record, I was using Mac OS X 10.5 (Leop­ard) on a white Intel Core Duo Mac­Book at the time of this writ­ing. There isn’t any­thing ter­ri­bly non-standard about my par­tic­u­lar setup that is worth men­tion­ing, other than a larger-than-standard hard drive and 3rd-party RAM. Obvi­ously, none of this will work on a PC run­ning Win­dows or Linux, although there are a bunch of places you can go to find out how to install nginx on other plat­forms. This arti­cle, how­ever, focuses only on the Mac platform.

Con­tinue read­ing “Installing nginx and PHP with FastCGI on Mac OS X 10.5 (Leopard)”

Tags: , ,