Click here to get back home

Center-Aligning elements

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Center-Aligning elements gaijinco 05-12-2008
Posted by Jukka K. Korpela on May 14, 2008, 4:27 pm
Please log in for more thread options
Scripsit Stefan Ram:

>> from the use of simple markup? After all, there is no adequate markup
>> for an image and its caption. (All the nice HTML 3 ideas were
>> forgotten long ago.)
>
> The closest approximation in HTML to associate an
> image (»data«) with a caption (»term«) is a DL element.

Bullshit. The caption is not a term. Check a dictionary for a definition
of "definition" and "term".

It is bullshit because such ideas have been proposed and proved wrong
many times, in this group and other discusssions.

> <dl><dt>Jacob Smith</dt><dd><img src="jacob.png" /></dd><dl>

Thank you for confirming that your statement is nonsense, by your use of
grossly invalid (and not just illogical) markup in a one-liner.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


Posted by Stefan Ram on May 14, 2008, 4:49 pm
Please log in for more thread options
>>The closest approximation in HTML to associate an
>>image (»data«) with a caption (»term«) is a DL element.
>Bullshit. The caption is not a term. Check a dictionary for a
>definition of "definition" and "term".

Thanks for the review! I also believe that the current
type »definition list« is not the best wording. Therefore,
I have suggested a more general element type in

http://lists.w3.org/Archives/Public/www-html/2003Aug/0029.html

from which I quote here:

Date: Fri, 8 Aug 2003 04:26:56 +0200
To: www-html@w3.org

Bottom-up Sections

Abstract: The definition elements dt and dd should be replaced
by a more general "bottom-up section" element with a "title" and
a "contents".

In several types of texts certain "small sections" appear, which
do not fit into the XHTML 2 section scheme. For example, in articles,
sometimes there are "boxes" treating certain topics or, in mathematics
texts, there are labeled theorems or proofs.

Such a proof can not be easily implemented using the XHTML 2 section
element, because its "level" then would depend on the level of the
containing section, while it should always be the same "low" level -
independent of whether it is part of a section or a chapter.

The best approximation might be to use a definition list for it,
where a name like "proof 2.14" is the definition term and the
text is the definition description. But using a definition list
for this case seems somewhat abusive because a proof is not a
definition and a proof is not a list.

A pair of dt and dl elements can be regarded as a definition, but
this definition pair lacks orthogonality: Why must it always be
part of a list? Why do we have such a pair for a definition but
not for a resource description or a picture caption?

So one might consider to replace the dt-dl-pair by a more
general element: The "bottom-up section" ("bos"). Its "level"
does not derive from the level of the containing section but
from the level of the contained sections, therefore the name
"bottom-up".

It consists of

* a title (like the definition term)
* a contents (like the definition description)
* an optional role-attribute for the title
(like, e.g., "dt")
* an optional role-attribute for the contents
(like, e.g., "dd")

It may also appear where a list item may appear in an ordered
or unordered list, therefore a definition list can now be built
using the bottom-up section element and one of the list
elements, like the following unordered list of definitions.
(A list containing only a certain type of elements can
be marked as such using the containsonly-attribute.)

<ul containsonly="definitions">
<bos isa="definition">
<title role="dt">Flower</title>
<contents role="dd">The reproductive part of a plant</contents>
</bos>
</ul>

But such a definition-bos might as well be used outside
of a list, where ever a paragraph might appear.

Some values of the attribute "isa" and the attribute "role"
should be standardized, like a caption-picture-role, so that
the element might be used as a picture-caption-pair, as follows

<bos isa="titled picture">
<title role="caption">A Flower</title>
<contents role="picture"><object .../></contents>
</bos>

CSS should be extended so as to allow to specify, where the
caption appears in relation to the contents (e.g., above or below).

A proof then might be written as follows.

<bos isa="proof">
<title>3.12</title>
<contents>(Left as an exercise to the reader.)</contents>
</bos>

An FAQ-list as follows.

<ol containsonly="FAQ-entries">
<bos isa="FAQ-entry">
<title role="question">What is a Flower?</title>
<contents role="answer">The reproductive part of a plant</contents>
</bos>
</ol>

The possible values for the attributes "containsonly", "isa" and
"role" should be standardized, a generic use is possible for cases
not part of the standard by using the class-attribute as in

<bos class="exercise-question">
<title>Flowers</title>
<contents>What is a flower?</contents>
</bos>

Some types of sections might have multiple possible contents-roles:

<bos class="book description">
<title role="book title">Flowers</title>
<contents role="book ISBN">0-937383-18-X</contents>
<contents role="book description">It is about flowers.</contents>
</bos>

Some examples of applications include

* A definition with a term and a description
* A titled picture with a caption and a picture
* A description of a book or other resource
* A text type (isa) such as
- a proof
- a theorem
- an example
- a warning/caveat
- an abstract, a conclusion
- a comment
- a listing
- a BNF production
- a background information
- an exercise


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?

Posted by Jukka K. Korpela on May 15, 2008, 4:42 pm
Please log in for more thread options
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.

Yes, but not if I'm using <table align="left">.

Regarding inline-block vs. float, what's the point? Support to
inline-block is increasing but still more limited than support to float.

> But images are just as often more like blocks so the HTML requirement
> is a bit annoying.

Well, yes, if you just want to put an image between paragraphs. If you
aim at Strict, you need a <div> wrapper, for no good reason. Then again,
if the image needs a caption (and images need captions far more often
than most authors think), you'll need some kind of a wrapper anyway.

> You can just use the style attribute for a one-off.

It's often just presentational markup in disguise. Is <td style="width:
500px"> really more logical, more structural, more advanced than <td
width="500">? If you use <td style="width: 25em">, then you get
something you don't get with HTML attributes, but that's just because
HTML attribute syntax is more limited.

> Mixing presentational attributes and CSS is particularly gruesome
> because then you've got to worry about the two different inheritance
> paths.

It's surely confusing when used to affect the same properties. But
mixing, say, the HTML align="left" for making a table floated and the
CSS td { font-family: sans-serif; } is not a problem. They play on
different things.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


Posted by Ben C on May 15, 2008, 4:58 pm
Please log in for more thread options
> 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.
>
> Yes, but not if I'm using <table align="left">.
>
> 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.

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.

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.

Similar ThreadsPosted
CSS for All Elements (Bullets February 22, 2005, 12:17 pm
CSS gap between inline elements February 7, 2008, 3:03 am
Form and nested elements November 10, 2004, 11:57 am
Visibility of form elements December 3, 2004, 8:01 pm
Presentational and Structural Elements September 22, 2005, 10:56 am
form elements which should not be submitted March 9, 2006, 3:17 pm
custom tags and elements December 5, 2006, 4:57 am
Don't print certain elements from a page February 17, 2007, 3:38 pm
Extending HTML Elements April 19, 2007, 8:46 am
How to push elements to the bottom August 21, 2007, 6:07 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap