Afficher un message
Vieux 29/03/2008, 10h53   #2
Ben C
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Pure space directly inside div ignored, but pure space directly inside span honored

On 2008-03-29, liketofindoutwhy@gmail.com <liketofindoutwhy@gmail.com> wrote:
> i found that there is a rule regarding "pure space" directly inside a
> block element or directly inside an inline element. For the following
> example, in compliance strict mode:
>
><body>
>
> <div>
>
> hello
> world
>
> </div>
>
>
>
> <div>
>
> <img src="pic.jpg">
> <img src="pic.jpg">
>
> </div>
>
>
></body>
>
> there are tons of spaces after the first <div>, and they are the
> newline and space characters. But none is honored. None is rendered.


It all gets collapsed to one space. Try setting white-space: pre on body
and you should see all your spaces.

[...]
> This seems like the rule, applicable on IE7, Firefox 2, and Safari 3.
> This being the general rule it seems, does the spec actually say
> something about this?


See CSS 2.1 16.6.1 which explains how white-space is collapsed.
  Réponse avec citation
 
Page generated in 0,04452 seconds with 9 queries