CSS equivalent of the center tag

Because I understand the temptation to sometimes just wrap a div in a damn <center> tag instead of messing around with auto margins, translatex(-50%), or any other such nonsense — and also partly as a future reference for myself — here is what I’ve found to be the CSS equivalent of the <center> tag.

.center-dammit {
    display: block;
    margin: 0 auto;
    text-align: center;
}

Caveat: I’ve not checked in depth so I’m sure there will be about a dozen exceptions. W3C, please sort this out for CSS4!

Of Ants and Rhinos

I recently opened a Pandora’s box when investigating incorporating LESS into a web project I’ve been working on. Long story short, I found myself having to compile Rhino into a jar I could execute.

Having installed Ant to perform the task, I ran the command and got the following exception:

C:\rhino1_7R5\xmlimplsrc\build.xml:129: src 'C:\rhino1_7R5\build\tmp-xbean\xbean.zip' doesn't exist.

Which is exactly what I want to be dealing with when investigating a CSS precompiler.

In any case I got to the bottom of the issue. So without further ado, here is…

The definitive list of steps for compiling Rhino

  1. Download the source from Rhino’s website
  2. Unzip it somewhere (let’s say, C:\rhino1_7R5″)
  3. Download Ant (if you don’t already have it) from Apache’s website
  4. Install Ant (instructions here)
  5. Download the zip from the following URL: http://archive.apache.org/dist/xmlbeans/binaries/xmlbeans-2.5.0.zip
  6. Create a folder in C:\rhino1_7R5\build\” called “tmp-xbean”
  7. Paste the zip from step 5 into this folder and rename it to “xbean.zip”
  8. Open a command prompt in C:\rhino1_7R5
  9. Run the command “ant jar”

For those interested, I worked this out by taking a look in the Ant build file for “xmlimplsrc”, which was the root of the error. This build XML file actually contains the location of the zip file which it’s failing to find. My guess is that it attempts to download it (install instructions are very unclear about the fact that they require an internet connection) and when that fails, your build fails. In my case it’s most likely due to my company network’s proxy restrictions.

I hope this helps.