|
Posted by Ben C on May 14, 2008, 6:00 pm
Please log in for more thread options > Scripsit Ben C:
[...]
>> For the sake of completeness, you could also mention using
>> inline-block in that document, especially as support for it is
>> improving.
>
> My problem with display: inline-block is that when it does not work, the
> effects can be devastating. Suppose that you use
><span class="pic"><img ...>caption text</span>
><span class="pic"><img ...>caption text</span>
> ...
> and do all the styling in CSS, using .pic { display: inline-block; }
> among other things. When this rule is ignored, the images and their text
> will run as a "line" with images as "large letters". Not nice. Using
><div> instead of <span> makes a difference but then the rendering is
> poor in a different way.
You'd have similar problems if you were using float and CSS was turned
off.
[...]
>> Yes, good point. (What's "semantically" inline about an image?)
>
> The Strict HTML requirement is rather formal as such, but an image _can_
> conceivably appear as an inline element. We don't need to use small
> image in place of special characters any more, but there can be
> legitimate reasons to include others small images inside running text,
> e.g. in an instruction manual "press the start button <img
> src="start.gif" alt="">".
Yes indeed, also for little link markers of the kind they use on
Wikipedia to mark external links.
Although actually they do those with background images which is slightly
ill-advised for a different reason-- background position is undefined by
CSS 2.1 for inline boxes, and so it's unclear where browsers are
supposed to put the image, especially if the inline box breaks across
lines. It might not coincide with the padding-right area they reserve
for it.
But images are just as often more like blocks so the HTML requirement is
a bit annoying.
>>> Oh, and even IE 7 doesn't support it in Quirks Mode. This means that
>>> sufficiently old IE versions don't support it at all (but can handle
>>> align="center" fine).
>>
>> So people using old IE versions won't get things centered. Tough.
>
> The question is whether you want to use a little more complicated CSS
> code instead of a simple HTML attribute just to prevent old browsers
> from rendering the page the way you want. :-)
Well I would have phrased it as whether you want to use a little more
complicated HTML fu instead of some simple CSS just to support obsolete
browsers.
[...]
> This might mean that things are easier to the author, though there can
> be a potential cost that visitors pay (if lack of centering is a
> problem, and we need to assume it is _some_ kind of a problem, otherwise
> we wouldn't be doing centering).
Interesting logic.
> It depends on what you wish to center in which context. Sometimes you
> can use a nice selector, e.g. when you want to center all tables. But if
> you wish to center this image here and that table there, you would find
> yourself writing class attributes and perhaps trying hard to invent
> semantically oriented class names, instead of class="center", which
> looks pretty silly.
You can just use the style attribute for a one-off.
Mixing presentational attributes and CSS is particularly gruesome
because then you've got to worry about the two different inheritance
paths.
<table align="right">
<tr>
<td style="text-align: left">
<table>
<tr>
<td style="width: 500px; border: 1px solid green">
Left or right?
</td>
</tr>
</table>
</td>
</tr>
</table>
According to HTML rules as I read them, the text "Left or right" should
be on the right of its cell. But according to the CSS 2.1
work-in-progress drafts, it should be on the left. Which is supposed to
win?
|