473,386 Members | 1,698 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.

Dynamic hanging indent

A publication style guide indicates that for a table heading like the
following,

Table 3. Wheat and rye harvest in European countries in years that end in 3
or 7 or when a new prime minister takes office.

when the heading flows over more than one line, a hanging indent should be
used, such that the remainder of the heading should be left-aligned, in this
example, with "Wheat", leaving "Table 3. " standing off by itself on the
left.

The style guide was created by print-based designers, and some of their
guidelines will need to be altered or scrapped for web publication. But is
there some way to fulfill this particular guideline as specified on the WWW?
The problem is that the width of the indent has to be dynamic, since the
table designator's width depends on the font and on its content (which could
just as well be Table 37M). The distance between the first period and the
following word is specified as two em spaces, which maybe padding or a
margin could take care of.

I suppose this should all be in a CAPTION element, but alternatively it
could be an H1 preceding the TABLE element.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.

Jul 20 '05 #1
6 6674

"Harlan Messinger" <h.*********@comcast.net> wrote in message
news:2p************@uni-berlin.de...
A publication style guide indicates that for a table heading like the
following,

Table 3. Wheat and rye harvest in European countries in years that end in 3 or 7 or when a new prime minister takes office.

when the heading flows over more than one line, a hanging indent should be
used, such that the remainder of the heading should be left-aligned, in this example, with "Wheat", leaving "Table 3. " standing off by itself on the
left.


In other words, the kind of indent you get if you paste the following into a
fixed-width editor:

Table 3. Wheat and rye harvest in European countries
in years that end in 3 or 7 or when a new prime
minister takes office.

Jul 20 '05 #2
On Mon, 30 Aug 2004 14:14:22 -0400, Harlan Messinger
<h.*********@comcast.net> wrote:
Table 3. Wheat and rye harvest in European countries
in years that end in 3 or 7 or when a new prime
minister takes office.


Sadly, caption is inline. Perhaps something like this? Untested.

caption {display: block; width: 100%; font-size: 100%; text-indent: -3em}

Adjust ems of the indent to what works. Fails in non-CSS environments, but
that's to be expected.
Jul 20 '05 #3
"Harlan Messinger" <h.*********@comcast.net> wrote:
A publication style guide indicates that for a table heading - -
when the heading flows over more than one line, a hanging indent
should be used, such that the remainder of the heading should be
left-aligned,
I'd like to refer to the recent thread "CSS: basic indentation question",
which was mistakenly started in c.i.w.a.h but continued here. It dealt
with similar issues for headings (h2 etc.) and paragraphs. Some of the
ideas suggested there might apply to your case.
I suppose this should all be in a CAPTION element, but alternatively
it could be an H1 preceding the TABLE element.


Using a heading element of suitable level is imaginable, and then e.g.
the technique I suggested would seem to work. However, H1 does not sound
natural if it's "Table 3".

In this case my approach could mean markup like

<h2><span class="nr">Table 3.</span>
Wheat and rye harvest in European countries in years that end
in 3 or 7 or when a new prime minister takes office.</h2>

and CSS code like

h2 { position: relative;
margin-left: 4.5em; }
h2 .nr { position: absolute;
left: -4.5em; }
h2 { font-size: 100%;
margin-bottom: 0.5em; }

The awkward part is guessing a value like 4.5em so that there's not too
much gap and no overlap of the "Table 3." text and the heading text -
because the width of the text "Table 3." varies by font size.

It would in my opinion be better to use <caption> markup, but e.g. <h2>
isn't wrong either, and styling <caption> seems to be more difficult.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #4

"Neal" <ne*****@yahoo.com> wrote in message
news:op**************@news.individual.net...
On Mon, 30 Aug 2004 14:14:22 -0400, Harlan Messinger
<h.*********@comcast.net> wrote:
Table 3. Wheat and rye harvest in European countries
in years that end in 3 or 7 or when a new prime
minister takes office.
Sadly, caption is inline. Perhaps something like this? Untested.

caption {display: block; width: 100%; font-size: 100%; text-indent: -3em}


But then the indent is hard-coded, which I could do with padding-left and
text-indent.

Adjust ems of the indent to what works. Fails in non-CSS environments, but
that's to be expected.


One of my attempts is now at

http://gavelcade.com/tests/hangindent.html

In IE6 the general arrangement is right, but as I widen or narrow the
browser, the distance between the Table 3 and the rest of the heading
varies, and NOT in a uniform direction! It jumps back and forth. In Mozilla
and Opera, it's hopeless--the main part of the heading appears below the
Table 3.

It doesn't matter whether I include the style on the THEAD or not.

Jul 20 '05 #5

"Jukka K. Korpela" <jk******@cs.tut.fi> wrote in message
news:Xn*****************************@193.229.0.31. ..
"Harlan Messinger" <h.*********@comcast.net> wrote:
A publication style guide indicates that for a table heading - -
when the heading flows over more than one line, a hanging indent
should be used, such that the remainder of the heading should be
left-aligned,
I'd like to refer to the recent thread "CSS: basic indentation question",
which was mistakenly started in c.i.w.a.h but continued here. It dealt
with similar issues for headings (h2 etc.) and paragraphs. Some of the
ideas suggested there might apply to your case.


Thanks, I'll look.
I suppose this should all be in a CAPTION element, but alternatively
it could be an H1 preceding the TABLE element.
Using a heading element of suitable level is imaginable, and then e.g.
the technique I suggested would seem to work. However, H1 does not sound
natural if it's "Table 3".


It's for a section of the site where a series of tables are listed. The
page's sole purpose is to display the table. So it makes sense to use a
heading, though I suppose indeed it would be H2 or H3.

In this case my approach could mean markup like

<h2><span class="nr">Table 3.</span>
Wheat and rye harvest in European countries in years that end
in 3 or 7 or when a new prime minister takes office.</h2>

and CSS code like

h2 { position: relative;
margin-left: 4.5em; }
h2 .nr { position: absolute;
left: -4.5em; }
h2 { font-size: 100%;
margin-bottom: 0.5em; }

The awkward part is guessing a value like 4.5em so that there's not too
much gap and no overlap of the "Table 3." text and the heading text -
because the width of the text "Table 3." varies by font size.
Yep.

It would in my opinion be better to use <caption> markup, but e.g. <h2>
isn't wrong either, and styling <caption> seems to be more difficult.

Thanks for the tips.

Jul 20 '05 #6

"Harlan Messinger" <h.*********@comcast.net> wrote in message
news:2p************@uni-berlin.de...

"Harlan Messinger" <h.*********@comcast.net> wrote in message
news:2p************@uni-berlin.de...
A publication style guide indicates that for a table heading like the
following,

Table 3. Wheat and rye harvest in European countries in years that end in
3
or 7 or when a new prime minister takes office.

when the heading flows over more than one line, a hanging indent should
be used, such that the remainder of the heading should be left-aligned, in

this
example, with "Wheat", leaving "Table 3. " standing off by itself on the left.


In other words, the kind of indent you get if you paste the following into

a fixed-width editor:

Table 3. Wheat and rye harvest in European countries
in years that end in 3 or 7 or when a new prime
minister takes office.


I wound up deciding to do this with display: table and display: table-cell
for browsers more advanced than IE, and it works beautifully in Opera and in
everything Mozilla-related from Netscape 6 on. For IE I decided to take the
simple approach, allowing a fixed 5em for the Table designation.

/* Hanging table title indent for IE only, overridden below for more
sophisticated browsers. (Hide it from Netscape 4.x. and below.) */
/*/*/
h3 { position: relative; left: 5em; font-weight: bold;
text-align: left; margin-right: 6em; }
h3 .tablenum { position: absolute; top: 0; left: -5em;
width: 5em; padding: 0; text-align: left; }
h3 .tabledesc { }
/* */

/* Hanging table title indent for more CSS-compliant browsers */
*>h3 { position: static; display: table; text-align: left; margin-right:
auto; }
*>h3 .tablenum { position: static; width: auto; display: table-cell;
white-space: nowrap; padding: 0 1em 0 0; text-align: left; }
*>h3 .tabledesc { display: table-cell; }

Jul 20 '05 #7

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

Similar topics

25
by: Shannon Jacobs | last post by:
Maybe there is a simple trick here, and I'm not spotting it... Is there a guru of CSS hanging around here who can help out? The page in question has a multi-column table with a list of links in...
0
by: Onin Tayson | last post by:
Hi All, How can I make my RadioButtonList to have a hanging indent when the text wraps to the next line? Example: O This is the default behavior when the text wraps.
1
by: census | last post by:
What I need my context menu to do is this Options -> Accounts -> Delete Account -> <these need to auto index based on existing accounts> I've done this before in VS2003, but when I...
1
by: spark86 | last post by:
I currently have an xform where I'm trying to have the user input first and last name and then when it submits it goes to a file with the path first_last.xml. Here is what I have currently: ...
1
by: =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?= | last post by:
Hello guys, I was wondering if anybody here had implemented a solution where Tables are aligned according to what the hanging indent tells us when there is a potential for the table overflowing...
1
by: sshafer1 | last post by:
I am working on a survey. All survey's will have five tabs (pages) that have the same types of questions. The questions fall under these five categories. Question Category Business / Billing...
5
by: Stanimir Stamenkov | last post by:
I'm trying to style an icon "hanging" below the first line of a heading and I've found interesting difference between Mozilla and the other browsers I'm trying with - Safari 3.1.1, Opera 9.27 and...
4
by: rahxephon | last post by:
I am new to CLI/c++ and have some question on the 2 type of array stated above. I am doing some numerical calculation on large number of sample and face some problem with the speed on accessing the...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.