Johannes: Harte Nuss: Firefox positioniert nicht absolut bei XHTML doctype

Beitrag lesen

Hallo Leute,

ich habe hier ein Problem, dass mir mit Firefox 1.5.0.7 extremes Kopfzerbrechen bereitet.

Folgendes Skript funktioniert wunderbar wenn der Doctype NICHT xhtml ist:

function createAbsolutePositionedDiv() {
 var md = document.body.appendChild(document.createElement('div'));
 md.style.position = 'absolute';
 md.style.height = '100px';
 md.style.width = '100px';
 md.style.top = '100px';
 md.style.left = '100px';
 md.style.backgroundColor = 'red';
}

Sobald der Doctype so oder so ähnlich ist funktioniert es nicht mehr:

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

Ich habe schon alle dreckigen Tricks probiert - das Div an ein unsichtbares Div attached und sichtbar gemacht, etc.. etc.. - sobald XHTML im Spiel ist landet das Div bei firefox immer am Ende des Dokuments. Kennt jemand das Problem? Exzessives Googeln hat leider noch nichts gebracht ;)