|
Convenient web based access to our favorite web design Usenet groups
|
 |
This is Interesting: Free Magazines for Graphics designers and webmasters
| Author |
| Thread |
 |
|
|
|
|
|
 |
 |
 |
Images with captions centered? |
 |
|
 |
|
|
|
  09-16-05 - 12:39 AM
|
Hello,
I've been struggling with this problem for a while now, so I though I'd
get some input from anyone more skilled with CSS than I am.
I'm actually trying to accomplish two things with this:
1. Create a floated image with text around, with a caption centered
underneath. Image size can be varied but the caption needs to have a
fixed size to make it break correctly I think. I also need the image to
resize automatically when the browsers width gets very small, using the
'max-width' attribute, and this is where the problem lies, since Firefox
does not seem to accept the max-width attribute and handles it like the
image is non-existent or very small. It works like expected in MSIE 6 and
Opera 8.
2. Inspired by a 'A List Apart' article (see [1] below), I'm trying to
create a fluid way to display images with captions, but with the image-
display *centered* and with the possibility of different image sizes (ALA
had fixed image sizes). I've tried many different solutions but recently
tried using 'display: image-block' which judging from the CSS 2.1
standard should be the way to go, and it works perfectly in Opera but
fails totally in FF and MSIE, who just displays the images one below the
other.
I know the first problem can be fixed by not using max-width but I'd
really like to have it work with it. I guess Opera is the only browser
supporting on-the-fly resizing of images this way, is this correct?
As to the second problem, my guess is that using another solution than
inline-block would solve it but I've tried display:block and different
wrapper classes. Floating to the left would do it but I really want the
images centered, not to the left.
Is there a standards-compliant way to make this work in both Opera, FF
and MSIE?
I have created a test case for both problems here:
http://stian.freeshell.org/test/float/float.html
Could someone please have a look at this and give me some hints to what I
can do to fix the problems or improve the methods I'm using?
reagards,
Stian
links:
[1] http://www.alistapart.com/articles/practicalcss/
|
|
|
| [
Post Follow-Up to this message ]
|
|
|
|
|
 |
 |
Re: Images with captions centered? |
 |
|
 |
|
|
|
  09-16-05 - 12:39 AM
|
Stian Lund wrote:
> Hello,
Hi :-)
> I've been struggling with this problem for a while now, so I though I'd
> get some input from anyone more skilled with CSS than I am.
>
> I'm actually trying to accomplish two things with this:
>
> 1. Create a floated image with text around, with a caption centered
> underneath. Image size can be varied but the caption needs to have a
> fixed size to make it break correctly I think. I also need the image to
> resize automatically when the browsers width gets very small, using the
> 'max-width' attribute, and this is where the problem lies, since Firefox
> does not seem to accept the max-width attribute and handles it like the
> image is non-existent or very small. It works like expected in MSIE 6 and
> Opera 8.
>
> 2. Inspired by a 'A List Apart' article (see [1] below), I'm trying to
> create a fluid way to display images with captions, but with the image-
> display *centered* and with the possibility of different image sizes (ALA
> had fixed image sizes). I've tried many different solutions but recently
> tried using 'display: image-block' which judging from the CSS 2.1
> standard should be the way to go, and it works perfectly in Opera but
> fails totally in FF and MSIE, who just displays the images one below the
> other.
>
> I know the first problem can be fixed by not using max-width but I'd
> really like to have it work with it. I guess Opera is the only browser
> supporting on-the-fly resizing of images this way, is this correct?
I'm not sure if the max-width will work in combination with the
example I give below, but I'm interested in the results when you try
it out.
> As to the second problem, my guess is that using another solution than
> inline-block would solve it but I've tried display:block and different
> wrapper classes. Floating to the left would do it but I really want the
> images centered, not to the left.
>
> Is there a standards-compliant way to make this work in both Opera, FF
> and MSIE?
>
> I have created a test case for both problems here:
> http://stian.freeshell.org/test/float/float.html
>
> Could someone please have a look at this and give me some hints to what I
> can do to fix the problems or improve the methods I'm using?
[...]
> [1] http://www.alistapart.com/articles/practicalcss/
Feel free to scrutinize the code:
http://locusmeus.com/test/thumbswit...nscentered.html
The reason for the tables is that I had images of different heights,
which I wanted vertically centered per row.
--
Els http://locusoptimus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Juicy Lucy - Who Do You Love?
|
|
|
| [
Post Follow-Up to this message ]
|
|
|
|
|
 |
|
|
 |
 |
Re: Images with captions centered? |
 |
|
 |
|
|
|
  09-16-05 - 12:39 AM
|
Spartanicus <invalid@invalid.invalid> wrote in
news:pd1ji1dhv3bbrsb9ntfab689lj6qtp0p2i@news.spartanicus.utvinternet.ie:
> http://www.spartanicus.utvinternet....lery_with_capti
> ons.htm
Thanks for the pointer, a very good solution, although maybe not as
'intuituve' as the ALA one. However, I would rather not have to specify
the width in the img tag, while the width in '#gallery span' is ok since
it controls the captions wrapping, which is important.
I tried removing the width and height attributes and inserting some
larger images (250+300px) -- it still seems to work nicely in Firefox and
MSIE, but Opera insists on layering the images over each other if they
are larger... grr :/
Removing 'display: inline-block' from #gallery span solves this
fortunately :), but I don't know what problems this might cause with
other browsers since I only have FF, MSIE and Opera. Also, the caption is
not centered under the image in MSIE.
Example:
http://stian.freeshell.org/test/float/spartanicus.htm
I'm aware it doesn't look very good, but it's a bit closer to what I
wanted...
Any other ideas or tips?
Stian
|
|
|
| [
Post Follow-Up to this message ]
|
|
|
|
|
 |
|
|
 |
|
|
 |
 |
Re: Images with captions centered? |
 |
|
 |
|
|
|
  09-17-05 - 12:43 AM
|
Spartanicus <invalid@invalid.invalid> wrote in
news:v9kji1ddtne02o0rfqhbic84il5oc72slb@news.spartanicus.utvinternet.ie:
> Did you even bother to look at the code, or read the article?
Yes, I did, and I'm dropping this right now, as it seems we are
constantly misunderstanding each other :/
> You can't just plonk other images into my code, my code contains the
> width suitable for *my* 172px wide images. If you want to use it with
> other images you'll have to change that.
I'm *aware* of that, I was merely using your code as a template to see if
I could make something out of it that worked for my uses. As I said I did
not want to specify the widths per image, and your demo only works with
images of the same width. If I have offended you by utilizing your code
this way I am sorry.
Here's what I've found:
With display: inline-block Opera needs to have width of the image set
explicitly while FF and MSIE apparently don't need to. I suspect that
Operas behaviour is the *correct* one though. Luckily, Opera supports
inline-table as well and it works the way I want it, while MSIE does not,
so I just need to use the inline-block hack to make IE display it like I
want.
Working on it... thanks for all help!
Stian
|
|
|
| [
Post Follow-Up to this message ]
|
|
|
|
|
 |
|
|
 |
 |
Re: Images with captions centered? |
 |
|
 |
|
|
|
 |
| All times are GMT. The time now is 06:16 AM. |
 |
|
|
|
|
|  |
|