Wednesday, 9 April 2008

Gotcha: Why position:fixed header scroll?

Look at http://mix08.com and you can see the header was not scrolling because it has position:fixed in its CSS class. We tried to do something similar but the header keep scrolling. The html is very simple, too simple to have anything wrong, so we couldn't tell what's the problem with it.

All we were missing, was this - the DOCTYPE:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

After we discovered it of course I did say "Of course!" (not "Eureka!"). But when we were writing HTML in notepad, the simplest thing is always what we would have forgotten.


I tell you, life is full of small annoying stupid problems like this one.

2 comments:

  1. can you do fixed:position header in blogger and if so, why not on this page "dev-for-fun.blogspot.com?

    ReplyDelete
  2. yes you can. the bar of this blog was fixed at one stage, but one day, I suddenly not prefer that anymore, so I removed it.

    ReplyDelete