Re: is <div style="display: inline"> identical to <span>?
On 2008-03-18, Michael Fesser <netizen@gmx.de> wrote:
> .oO(Summercool)
>
>>There is often a discussion of
>>
>> <div style="display: inline">
>>
>>being able to make a block element into an inline element.
>
> This is _never_ possible. A block-level element remains a block-level
> element, regardless of the CSS rules you apply to it.
No, "block-level" is just a function of CSS properties.
CSS 2.1 9.2:
Block-level elements are those elements of the source document that
are formatted visually as blocks (e.g., paragraphs). Several values
of the 'display' property make an element block-level: 'block',
'list-item', and 'run-in' (part of the time; see run-in boxes [p.
120] ), and 'table'.
> CSS only affects
> the rendering, it doesn't change the element type.
Correct, but "block-level" doesn't mean the same as "member of %BLOCK in
the HTML DTD".
I don't think HTML specifications use the term "block-level". If they do
then it's even more confusing...
>>so is it true that
>>
>> <div style="display: inline">
>> [any possible markup here...]
>> </div>
>>
>> is *identical* to
>>
>> <span>
>> [any possible markup here...]
>> <span>
>>
>>and vice versa,
>>
>>is <span style="display: block"> identical to a <div>?
>
> No. The rendered result might look the same, but the elements are still
> completely different and have to follow the rules of the DTD.
Yes this is still true.
|