473,386 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Scalable figures with captions: supporting traditional typography

For some time I've struggled with the problem of displaying simple
captioned figures on webpages in a way that is robust and scalable. I
tend to make "boring" (um, I mean "conservatively elegant") pages that
are text-heavy and that resemble academic publications. Despite the
origin of HTML in the world of scientific communication, the absence
of a FIGURE element to serve as a counterpart to the TABLE element is
surprising. This topic has been discussed in c.i.w.a.s before; if you
search the group for "figures and captions" you'll find some earlier
threads.

I had been working on a table-based approach, but for now have given
up on that because of inheritance inconsistencies across browsers. I
am now experimenting with a div-based approach which so far is working
well, at least for simple single-image figures. My experiments are
based on an earlier proposal for captioned figures by Bert Bos; I've
tried to extend his work by adding a few new features. My
demonstration page is here:

http://rjohara.net/server/css-figures-captions/

If you have an interest in captioned figures and/or traditional
typography take a look and see if you can identify any problems with
the page. An important feature of these figures is that they are
scalable: if the page author specifies that the figure should be 50%
of the width of the textblock, it should stay that way even when the
viewport dimensions change or the font size changes.

One weakness of the approach shown on this page is that it makes
considerable use of the max-width property, which is not supported on
the most common browsers today (IE5&6). The figures don't break under
these browsers, but if an author uses an image with small intrinsic
dimensions it may over-scale when the viewport is wide.

Bob O'Hara (http://rjohara.net)
Jul 20 '05 #1
5 2734
Robert J. O'Hara wrote:


If you have an interest in captioned figures and/or traditional
typography take a look and see if you can identify any problems with
the page.


Robert,

I looked at the page with IE 5.5 and NN 7.1 maximized on a 600 X 800 screen.

I recommend adding min-width to the images. On both browsers when I
narrowed the screen to cell-phone size, the smaller images went to 1
pixel and then vanished. The min-width should be expressed in ems and be
equal to the longest word in the caption/legend, to avoid text flopping
outside the figure border (which will also happen on a 'medium' sized
screen at very large text sizes).

This will limit, at the extremes, the extent to which you can retain
your 'optimum' proportion of text and image space across the page width,
but you've already accepted that limitation with regard to the maximum
useful size for an image, so the trauma should be minimal.

See http://pages.prodigy.net/chris_beall/sandbox/index.html. Each
navigation image has a caption (button). As the screen size is reduced,
the image will reduce UNTIL THE BUTTON SIZE IS REACHED, but no further.
(When that limit is reached, the 'figures' spill gradually from a
horizontal layout to a vertical one).

I did some experiments on image scaling and concluded that an image can
be scaled to 2X its 'natural' size without annoying pixellation. So I
recommend that you try to guess the size of the largest window any user
will employ and process the natural image to be about half that size.

Others will caution you that browsers, unlike image-specific tools like
PhotoShop, do not do a great job of scaling images, even to smaller than
'natural' sizes. You must be content to accept this if you use this
technique.

On NN 7.1 I tried changing the text size. The 4th image (fall leaves)
did not seem to scale with the text reduced to 50% or enlarged to 200%.

Chris Beall

Jul 20 '05 #2
Crossposted and follow up set to ciwah, as this has nothing to do with
css.

rj*****@post.harvard.edu (Robert J. O'Hara) wrote:
Despite the
origin of HTML in the world of scientific communication, the absence
of a FIGURE element to serve as a counterpart to the TABLE element is
surprising.
What do captioned images have to do with tables?

Html does not need an element to associate an image and it's caption,
see below.
I had been working on a table-based approach, but for now have given
up on that because of inheritance inconsistencies across browsers.
An image and a caption do not constitute tabular data. The textual
replacement of the image and it's caption should form a single sentence.
Thus there is no need for an html element to group/associate the image
and it's caption, they are one.
I am now experimenting with a div-based approach which so far is working
well, at least for simple single-image figures.
I also consider div's the wrong type of markup. An image with it's
caption should be marked up as a paragraph, if the caption is beneath
the image then the image's alt content should be specified as a prefix
to the caption:

<p><img src="butterfly.jpg" alt="Picture of" title=""><br>A
butterfly</p>

Using a div instead of a paragraph makes it difficult for users to
associate the right image with the right caption when there are a number
of captioned images in sequence (e.g. image galleries).
http://rjohara.net/server/css-figures-captions/

If you have an interest in captioned figures and/or traditional
typography take a look and see if you can identify any problems with
the page. An important feature of these figures is that they are
scalable: if the page author specifies that the figure should be 50%
of the width of the textblock, it should stay that way even when the
viewport dimensions change or the font size changes.


There are a number of reasons why you should not specify anything other
than the intrinsic dimensions of an image in html:

A) Browsers do a poor job when scaling images.
B) One reason for specifying an image's dimension in the html is that
browsers should be able to layout a page before the images have finished
downloading, percentage scaling not only thwarts that, it adds to the
problem by requiring that the entire page including *all* it's
dependencies are downloaded. This is unacceptable.
C) Using oversized images to enable the "scaling" causes the download
times of the content to increase significantly, your demo page is a good
example of that, it loads far slower than it needs to.

--
Spartanicus
Jul 20 '05 #3
Chris Beall <Ch*********@prodigy.net> wrote:
I recommend adding min-width to the images. On both browsers when I
narrowed the screen to cell-phone size, the smaller images went to 1
pixel and then vanished. The min-width should be expressed in ems and be
equal to the longest word in the caption/legend, to avoid text flopping
outside the figure border (which will also happen on a 'medium' sized
screen at very large text sizes).
A very good idea. I have no direct experience with hand-held browsers,
but on principle this would seem to be appropriate. It could also be
something made specifically to apply under a "handheld" media type (if
that is supported on the tiny browsers).
See http://pages.prodigy.net/chris_beall/sandbox/index.html. Each
navigation image has a caption (button). As the screen size is reduced,
the image will reduce UNTIL THE BUTTON SIZE IS REACHED, but no further.
A nice example.
On NN 7.1 I tried changing the text size. The 4th image (fall leaves)
did not seem to scale with the text reduced to 50% or enlarged to 200%.


Don't have NN7 and haven't been able to reproduce that one. I'll keep
checking. I did find an IE6 display bug: when the window is very wide
the full-width figure collides with the right column and is pushed
down. This appears to be some species of box model bug in IE6; it can
be worked around, but inelegantly. It is not relevent to the specific
scaling problem, however.

RJO
Jul 20 '05 #4
Spartanicus wrote:
Crossposted and follow up set to ciwah, as this has nothing to do with
css.

Translation for the original poster, who seems not to have made the jump:

Spartanicus's response was also posted to
comp.infosystems.www.authoring.html, where there has been considerable
additional discussion of the HTML implications related to your original
post. You might want to take a look there.

Chris Beall

Jul 20 '05 #5
Chris Beall wrote...
Spartanicus wrote:
> Crossposted and follow up set to ciwah, as this has nothing to do with
> css.


Translation for the original poster, who seems not to have made the jump:

Spartanicus's response...


I always try not to feed the trolls. :-)

If you search ciwas in Google groups for "figures and captions" you'll
find a thorough discussion from 2002 that covered many of the markup
aspects of the captioned figure question.

RJO
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Robert J. O'Hara | last post by:
I'm one of those people who practices what some consider "dull" and others consider "elegantly conservative" page design. I appreciate good traditional typography and standards-compliant liquid...
5
by: Robert J. O'Hara | last post by:
For some time I've made use of the max-width property in CSS to cause my pages to appear as a centered block against a contrasting background. This works well in new browsers (Mozilla, etc.) and...
4
by: CB US 77 | last post by:
I use a piece of javascript to create a photo gallery slideshow. The slideshow part works great, but I would like to add captions to each picture. If you want to see the html, send me an email to...
17
by: Stian Lund | last post by:
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:...
3
by: David | last post by:
Hi, I need a button shown for each record (cont. form) with specific captions on each. I have a notes form for each record. When a user presses the button they can read the notes. I want to...
144
by: Natt Serrasalmus | last post by:
After years of operating without any coding standards whatsoever, the company that I recently started working for has decided that it might be a good idea to have some. I'm involved in this...
2
by: harambeegirl | last post by:
I have read the CSS tutorial at W3Schools.com. It states that the caption-side property is not supported in IE6. If I want to add captions to my images, what else can I do?
7
by: Johnny | last post by:
In MSIE table captions are displayed at the same size as content. But in Firefox the text displays at browser default, It also exceeds the width of the table and the excess is hidden if the table...
21
by: Grant Edwards | last post by:
I need to be able to generate a PDF report which consists mostly of vector images (which I can generate as encapsulated Postscript, PDF, or SVG). What I need is a way to combine these figures...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.