|
Posted by Jukka K. Korpela on May 19, 2008, 11:54 am
Please log in for more thread options
Scripsit Ben C:
>> Scripsit Ben C:
>>
>>>> My problem with display: inline-block is that when it does not
>>>> work, the effects can be devastating.
>> [...]
>>> You'd have similar problems if you were using float and CSS was
>>> turned off.
Having studied this a bit more, I think there's also the problem that
when you use <div> for the image/caption combinations that you then turn
to inline blocks in CSS, IE incorrectly defaults the width to 100% of
the available width. We can fix this by explicitly setting the width to
the image width, or that width plus some padding etc., but it's somewhat
less flexible then.
And when I use <span>, the non-CSS rendering is just awful, unless I use
<br>, doing something like
<span class="pic"><img ...><br>
<span class="caption">caption text<br></span></span>
which is possible but a little clumsy.
>> Regarding inline-block vs. float, what's the point? Support to
>> inline-block is increasing but still more limited than support to
>> float.
>
> With inline block the images in an image gallery can be different
> sizes without them "snagging" on each other as they try to float to
> the left.
I guess you're right, and we could use vertical-align to tune the
presentation in such cases.
> You can also put text-align: center on the container so they break up
> into centered rows, which is an effect I'm sure some people have asked
> for in these NGs in the past.
Point taken.
> The other nice thing about it is that the behaviour of replaced inline
> is very similar to that of inline-block so that the
> images-with-captions flow just like inline images do without
> captions. This makes it a good way to retro-fit captions.
Well, I don't think inline images are that common.
But the main problem is that browser support is poor. IE supports
display: inline-block since IE 5.5 but with flaws, such the one I
mentioned. Firefox 2 does not seem to support it all, and I think this
is strong enough reason to refrain from using it on www pages. Using
<br> a tolerable (?) fallback is possible, but the other methods work
fine - though with some of the nice features of inline blocks - on
practically all graphic browsers.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
|