Hallo Stefan!
(Ich möchte mich bei diejenigen, die im Englischen nicht so bewandt sind, schon jetzt entschuldigen, daß ich viele Zitate nur auf Englisch bringe.)
1)<span> als inline-level element kann nicht absolut positionert werden.
Also <span style="position:absolute; top:200px; left:300px">Test</span> funktioniert bei mir einwandfrei.
»»
Ja, stimmt. Es kann absolut positoniert werden.
Jedoch sei vermerkt: [damit ich halt wiedersprechen kann ;-) ]
In HTML 4.0:
"...These elements define content to be inline (SPAN) or block-level (DIV) but impose no other presentational idioms on the content...."
dann weiter:
"Style sheets provide the means to specify the rendering of arbitrary elements, including whether an element is rendered as block or inline. In some cases, such as an inline style for list elements, this may be appropriate, but generally speaking, authors are discouraged from overriding the conventional interpretation of HTML elements in this way."
Das würde doch meinen; man kann zwar <span> als block-level Element bestimmen, aber es ist nicht im Sinne des Erfinders.
Generell finde ich das immer etwas verwirrend. Auf der einen Seite ist immer von block-level- und inline-Elementen die Rede, was aber meines Erachtens nur bei nicht-positionierten Elementen bzw. Elementen Sinn macht, die sich im normalen "Textfluss" befinden.
Glaube mir, das "Visual formatting model" hat mir einiges an Kopfzerbrechen beschert (und oft tut es noch immer).
In CSS2:
"...Block-level elements are those elements of the source document that are formatted visually as blocks (e.g., paragraphs). ...
In a block formatting context, boxes are laid out one after the other, vertically, beginning at the top of a containing block."
Dann weiter:
...Inline-level elements are those elements of the source document that do not form new blocks of content; the content is distributed in lines (e.g., emphasized pieces of text within a paragraph, inline images, etc.)...
In an inline formatting context, boxes are laid out horizontally, one after the other, beginning at the top of a containing block."
Wenn ich jetzt HTML 4.0 nehme, dann ist <span> inline-element. Nach CSS2 sollte es keinen neuen Block formen und der Inhalt ist in 'einer' linie. Wenn man mehrere <span>s aneinanderreiht sollten sie eine horizontale Reihenfolge haben.
Und das ist genau das, was <span> leistet.
Positionierte Elemente brechen aber den Textfluss auf, haben sinnvollerweise auch Angaben zu Breite und Hoehe und sind damit gewissermassen Block-Elemente, aber im freien Raum.
»»
Bist mir nicht böse, wenn ich das mal auch unter meine Lupe neheme? ;-)
"The width of a line box is determined by a containing block. The height of a line box is determined by the rules given in the section on line height calculations."
Wenn ich dem vorhergesagten zustimme und <span> als inline-elemet ansehe, sollte dessen Breite durch den umgebenden Box, die Höhe durch die 'line-heigt' Eigenschaften bestimmt werden.
Nicht desto trozt, wenn man CSS2 anschaut bleiben Fragen offen, viele Fragen. Und man neigt zu vergessen, daß CSS nur eine Ergänzungssprache zu HTML ist, weshalb die bestimmtnde 'Instantz' HTML sein sollte.
Was in HTML 4.0 mit '2' Sätzen erledigt ist (in Bezug auf <span>) bringt einem schier zum Verzweifeln, wenn man die ganze Boxmodellkonzepte anschaut im CSS2.
Grüße
Thomas