liketo findoutwhy wrote:

> I wonder if there can be any difference for
>
>  <div ...> ... </div>
>
> and
>
>  <span style="display:block ..." ... > ... </span>
>
> in other words, EVERYTHING is the same except a div is changed to a
> span, with display: block.

No differences are to be expected _if_ your CSS code will be applied _and_ 
no other stylesheets affect the rendering of these elements. But there are 
loads of reasons why your CSS code might not be applied, in part or at all; 
check the caveats list
http://www.cs.tut.fi/~jkorpela/css-caveats.html
Moreover, although div and span are "plain" elements in HTML - no rendering 
specialties should be expected except that div is rendered as a block - 
there is really no law against a browser stylesheet doing something special. 
And a user stylesheet, or some "author" stylesheet that your page may need 
to work with (like a corporate stylesheet) might really do something special 
with them.

When your CSS code, or specifically the inline code in the style="..." 
attribute, is not applied, the span element would appear as inline - 
effectively as if the span markup were not there at all. This means that 
there would be no implied line break before and after.

> the ultimate question is, Can they *DISPLAY* differently on major
> browsers? Can they BEHAVE differently on major browsers?

They surely _can_, but it is not probable that they _will_ - except for the 
fact that CSS might be "off", and then there's an essential difference. 
(Depending on the context, however, there might be no visible effect, if 
something else causes line breaks before and after.)

> I haven't seen a case in which they can be different, other than that
> they may or may not validate due to block element being inside
> another inline element.  Thanks very much!

Validity is a relevant aspect too, of course.

Generally, you should first create markup that works when CSS is "off", then 
start styling (potentially adding some markup just for CSS, such as class 
attributes). There's normally no reason to use <span> if you really intend 
to say display: block for it. But in special cases, e.g. when the markup is 
not under your control, you might need to change inline elements to block 
elements in CSS. (Of course this only changes them in CSS sense; in markup, 
<span> is still inline and <div> is block, as the validation issue 
indicates.)

Yucca 

______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to