Forum Moderators: open

Message Too Old, No Replies

How to line up columns without tables

         

tedster

12:55 pm on May 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm chewing on a formatting problem, and I feel like the answer is something I used to know - but I can't remember it now.

I have a long page full of acronyms and the phrases they stand for. I really want the search engines to see these two as directly related - the acronym and its expansion.

But, I also would like the page to have a nice visual format - all the expansions lined up as if at a tab stop on a typewriter would be great.

If I do this in a table, or in two divs, I'm concerned the "connection" between each acronym and what it stands for will be broken. But if I just line them up in sequence, the format will not be as easily readable.

Does anyone have a suggestion?

twisty

12:58 pm on May 20, 2002 (gmt 0)

10+ Year Member



Maybe a definition list?

tedster

1:11 pm on May 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That may be the way to go, but I wish the definition <dd> could be on the same line as the term <dt>.

It works OK with true, full length, definitions. But these are short little jobbies.

Marcia

1:14 pm on May 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<pre> </pre> ? Would that do it?

twisty

1:29 pm on May 20, 2002 (gmt 0)

10+ Year Member



There used to be a "compact" attibute for <dl> lists that did want you want, but I think it's now deprieciated in favour of a css solution...

tedster

1:29 pm on May 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe <pre> (don't really want a fixed width font, but...)

One other issue is that some of these "definitions" will contain links. I'm pretty sure anchor tags aren't valid inside <dl>. Anyone know if they are valid inside <pre></pre>? I never know what those W3C snippets [w3.org] mean.


<!-- excludes markup for images and changes in font size -->
<!ENTITY % pre.exclusion "IMG¦OBJECT¦BIG¦SMALL¦SUB¦SUP">

<!ELEMENT PRE - - (%inline;)* -(%pre.exclusion;) -- preformatted text -->
<!ATTLIST PRE
%attrs; -- %coreattrs, %i18n, %events --
>

moonbiter

1:44 pm on May 20, 2002 (gmt 0)

10+ Year Member



A (anchor) elements are valid inside any block-level or inline element except A (you can't nest anchors) and Button.

One real ugly way to do it with CSS immediately comes to mind:

<html>
<head>
<title>Ugly</title>

<style type="text/css">
dt, dd {
display: inline;
}
</style>

</head>

<body>

<dl>
<dt>item 1</dt>
<dd>description 1</dd><br />
<dt>item 2</dt>
<dd>description 2</dd><br />
<dt>item 3</dt>
<dd>description 3</dd><br />
</dl>

</body>
</html>

Not sure about backward compatability for that, though.

You could also do:

dt {
float: left;
}

And get rid of the line breaks. This way is better IMHO.

Use the margin-right property of the dt to set the spacing for the table.

Still, I think it is a logically valid use of a table to do a list. I mean, after all, they are associated by row ...

tedster

2:12 pm on May 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, at this point I'm thinking that having </td><td> between the two is the best proximity I can achieve if I want lined up formatting. Probably not so bad.

luma

3:56 pm on May 20, 2002 (gmt 0)

10+ Year Member



This might work (but it depends on your browser):
<dl compact>
<dt>foo</dt><dd>bar bar bar bar</dd>
<dt>foo foo foo foo</dt><dd>bla bla bla bla bla</dd>
</dl>