Friday, February 29, 2008

Help, my layout isn't centering!!1

It seems that this week, everyone and their dogs are asking me why their layouts aren't centering properly (when using the "margin:0 auto" css rule). Here's a quick list of reasons:

  • There's no doctype in the page. This causes IE to render in quirks mode. There are plenty of discussions on the web about why the quirks mode box model sucks, this is one of the reasons. Another variation of this is when there is an xml prolog on the page (the '<?xml version="1.0" ?>' stuff at the beginning of xml documents, which incidentally, also triggers quirks mode in IE. To fix it, add the doctype and remove the xml prolog.
  • There's no width on the div. The element taking the margin rule must have a quantifiable width (i.e. anything valid that is not "auto").
  • You have stray styles taking over. Open up the css inspector in Firebug and make sure that the div isn't floating (i.e. it must have no float rule, or have "float:none" applied to it) and that it's a block level element (i.e. it must have no display rule, or have "display:block" applied to it)
  • The parent element is too narrow. Make sure you don't set the width of the parent to something smaller than the div you're trying to center.

And no, "margin:auto auto" does not center stuff vertically.

More stupid security

View source on this page for a good laugh.

Thursday, February 28, 2008

Dee-dee-dee-dee

Is it my impression, or is D getting a fair amount of of attention lately?

Commenting tricks

Neat commenting trick, especially if you use a no-frills text editor, or can't be bothered learning the shortcuts for the dozens of editors you use.

I've actually used this myself for a long time. The only annoyance is that it doesn't work so well in CSS if you want to quickly comment out an entire stylesheet (or large portions of it) while debugging something.

Saturday, February 23, 2008

This is how NOT to do CAPTCHAs

Go here and try downloading a book. You'll get a CAPTCHA before the download. No biggie. Now try refreshing the page or download another book.

It's the same CAPTCHA! Talk about lame.

Hard drive encryption is broken

By cooling the DRAM, researchers can retain the logic state in the chip even without power.

It's becoming increasing difficult to protect data where untrusted parties have physical access to a machine.

Friday, February 22, 2008

Fun strip of the day

This is so cool.

IE8 User Agent String

Sites will break, people will complain. I think the IE team should put more thought into versioning in the javascript realm if they are really committed to "not breaking the web".

Thursday, February 21, 2008

More slickspeed results

Mootools added Dojo to their slickspeed benchmark page. DOMAssistant has its own benchmark page.

What's interesting to notice is that each library does well in Firefox, but not so much in IE6.

Wednesday, February 20, 2008

Mobile AJAX Performance

This is a very interesting research paper, about the perfomance and support of ajax libraris on new generation mobile devices.