3 <TITLE>Safari
1.0 PRE width bug
</TITLE>
4 <STYLE TYPE=
"text/css">
6 .box { background: #cc9; border: black solid 1px ; padding:0.5em; }
7 .dow { border-top: solid black 1px; border-bottom: solid black 2px; }
11 <BODY BGCOLOR=
"#FFFFFF" TEXT=
"#000000">
13 <H1>Safari
1.0 PRE width bug
</H1>
15 As noted in my
<A HREF=
"/1/blog/permalink/2003.0920">blog
</A>,
16 in certain cases Safari will miscalculate the width of a PRE element.
17 I think I've found the trigger. If a nested container element is preceded by
18 uncontained text and a blank line, and there are
"too many" characters
19 contained in the nested element, the PRE width will be too wide.
20 In the examples below, the nested element is a SPAN whose content
21 is the days-of-week line, as follows:
23 <SPAN CLASS=dow
> D M T W J F S
</SPAN
>
28 <table valign=top
width=
"100%"><tr><td width=
"1%">
31 <SPAN CLASS=dow
> D M T W J F S
</SPAN>
40 <td valign=top
width=
"99%">The blank line between '
2003' and the nested element
41 triggers the width bug.
43 </tr></table><BR CLEAR=all
>
47 <table valign=top
width=
"100%"><tr><td width=
"1%">
50 <SPAN CLASS=dow
> D M TWJFS
</SPAN>
59 <td valign=top
width=
"99%">The blank line between '
2003' and the nested element
60 triggers the width bug.
61 <P>Here, the excess whitespace is reduced by reducing the
62 number of characters contained by the nested element.
</P>
64 </tr></table><BR CLEAR=all
>
68 <table valign=top
width=
"100%"><tr><td width=
"1%">
70 <SPAN CLASS=dow
> D M T W J F S
</SPAN>
79 <td valign=top
width=
"99%">The blank line between '
2003' and the nested element
80 has been removed, so the bug is not triggered.
82 </tr></table><BR CLEAR=all
>
86 <table valign=top
width=
"100%"><tr><td width=
"1%">
87 <PRE CLASS=box
><SPAN> 2003</SPAN>
89 <SPAN CLASS=dow
> D M T W J F S
</SPAN>
98 <td valign=top
width=
"99%">The blank line between '
2003' and the nested element
99 no longer triggers the width bug, because now the '
2003' is itself contained by
100 a nested element (in this case, another SPAN).
102 </tr></table><BR CLEAR=all
>