It's weird that it works without doctype, i.e. by cutting off everything before the body element. But, I suppose that the browser starts making assumptions about what you mean when you right incorrect style code, just as it does with incorrect html markup.
Your problem is this
top: 30;
30 what? px, %, pt... Without doctype, I'm taking a wild guess that your browser assumes your document is HTML 4.01 Transitional and then goes on to assume that 30 means 30px.