Forum Moderators: open

Message Too Old, No Replies

reverse indent?

first line flush left, any additional lines indented

         

dcheney

2:42 am on Jun 5, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Howdy,
Is there a way to "reverse-indent" (i.e. first line flush left, any additional lines indented)?

SmallTime

4:15 am on Jun 5, 2002 (gmt 0)

10+ Year Member



Hi, welcome to WebmasterWorld.
If you are using css, a negative text-indent will work for several browsers, doesn't seem to for Opera. If you're not sure about css, this post should get you started [webmasterworld.com...]

papabaer

4:15 am on Jun 5, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A definition list provides this sort of layout. It is an often overlooked element the can provide increased visibility for sections of text with it's distinct layout. CSS will allow additional styling to add to the distinction.

The first line of a definition list is the <dt>, definition term which is then followed by the actual definition <dd>. Since these are seperate elements, it is very easy to apply individual styles.

<dl>
<dt><a href="bookcase_tutorial.htm">Build Me A Bookcase!</a> Lesson One.</dt>

<dd>Building a bookcase is a fun project. It is not complicated and can take many shapes and sizes.
Read more about this "easy-to-do" project in our Building a Bookcase Tutorial!</dd>

<dt><a href="trimwork.htm">Adding Fancy Trimwork</a> Lesson Two</dt>

<dd>The bookcase is almost complete: it's functional, it's sturdy, it's also rather plain.
Let's add some trim work to spruce it up. Afterall, it's going to be standing in your hallway.</dd>

<dt><a href="wood_finishing_tutorial.htm">Wood Finishing Made Easy</a> Lesson Three</dt>

<dd>Now that you have built your bookcase and added some fancy trim, now it's time to add some
stain and choose a finish. Are you ready for the Wood Finishing Tutorial? I know I am!</dd>
</dl>

dcheney

4:43 am on Jun 5, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Howdy,
Well I'm trying to avoid using a list because it adds so much extra horizontal white space. (Eventually there will be 7 parallel columns of these lists.) Currently I use a <ul>. Perhaps I can use styles to shrink the white space. (I'm still quite new to styles!)

papabaer

5:06 am on Jun 5, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



David, have you tried the definition list <dl>? It is much more compact than an ordered or unordered list. And yes, the margins and padding can be controlled using css though the default stlye may suit your needs as is.

W3C suggests using a definition list as a means to list proper names followed by dialog or commentary. It may offer the solution you seek.

- papabaer

SmallTime

5:22 am on Jun 5, 2002 (gmt 0)

10+ Year Member



Thanks papabear, I must have overlooked definition lists for years :)

papabaer

5:33 am on Jun 5, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



;) So have I!

What's funny is that the definition list can fill so many presentational requirements. It is a VERY overlooked element. And today, with the option of CSS, definition lists can be styled in just about any way imaginable.

papabaer

6:11 am on Jun 5, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here is an example of a <dl> with some additional stylings. Note the bottom padding added inline where multiple <dd>'s are used. The inline styles are used for an example. I would create a class to use in their place.

dd.pad {
padding-bottom:10px;
}

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Definition Lists for Fun &amp; Profit!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="Examples of XHTML Definition Lists, styled and unstyled" />
<style type="text/css" media="screen">
body{
margin:0;
padding:0;
font:12px georgia, "Book Antiqua", palatino, serif;
color:#000;
background:#fff;
}
dt {
padding:10px;
}
dd {
padding-right:10px;
}
h1 {
font:24px helvetica, arial, sans-serif bold;
color: #699;
background-color: transparent;
margin:5px 0 0 10px;
}
a:link{
color:#699;
background-color: transparent;
}
a:visited{
color:#699;
background-color: transparent;
}
a:active{
color:#000;
background-color: transparent;
}
a:hover{
color:#066;
background-color: transparent;
text-decoration:underline overline;
}
</style>
</head>

<body>
<h1>Woodworking Projects Are Fun!</h1>

<dl compact="compact">
<dt><a href="bookcase_tutorial.htm">Build Me A Bookcase!</a> Lesson One.</dt>

<dd>Building a bookcase is a fun project. It is not complicated and can take many shapes and
sizes. Read more about this "easy-to-do" project in our Building a Bookcase Tutorial!</dd>

<dt><a href="trimwork.htm">Adding Fancy Trimwork</a> Lesson Two</dt>

<dd style="padding-bottom:10px;">The bookcase is almost complete: it's functional, it's
sturdy, it's also rather plain. Let's add some trim work to spruce it up. Afterall, it's
going to be standing in your hallway.</dd>

<dd style="padding-bottom:10px;">Metal trim can also be added as a replacement for wooden
trimwork or an enhancement. We will take a look at some of the ways metal trimwork can add
flare to your project.</dd>

<dd>Want even more trim options? Well we have plenty of examples to show you of
"not-so-commom" trimming options, including some very neat plastic (yes, plastic!) corner
guards that double as connectors for stacking additional bookcases!</dd>

<dt><a href="wood_finishing_tutorial.htm">Wood Finishing Made Easy</a> Lesson Three</dt>

<dd>Now that you have built your bookcase and added some fancy trim, now it's time to add
some stain and choose a finish. Are you ready for the Wood Finishing Tutorial? I know I
am!</dd>
</dl>
</body>
</html>

Resist the shorthand property {padding:10px}unless you have tested. Declaring a value for all of your padding, top, right, bottom and left can give unexpected results. Leave the default, browser predetermined, formatting for the sides you do NOT need to control.

Inline styles shoud only be used for unique applications, not as standard practice. Otherwise we find our code almost as cluttered when <font> tags were used.

Definition lists are part of my every day XHTML element toolbox... ;)

SmallTime

6:28 am on Jun 5, 2002 (gmt 0)

10+ Year Member



Setting a margin-left seems to adjust the indent.

papabaer

6:35 am on Jun 5, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Right, in fact, you can really control all display aspects. It just takes a little experimentation. Be sure to test your styles in various browsers to check rendering.

tedster

6:23 pm on Jun 5, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I only recently discovered the wonders of a definition list - for definitions of all things!

I was creating a page of acronyms and their expansions, and it occurred to me that I needed a format that allowed the search engines to see the relationship between the Acronym and its full, spelled out version.

If I use divs or table cells, the visual presentation may be fine, but I realized that the logical relationships might not be clear to a spider or an algo.

The Definition List seems to be the obvious answer. The site launched last weekend and I await the SE Results with great anticiapation, since everyone of these acronyms is a potential keyword.

papabaer

9:06 pm on Jun 5, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I use divs or table cells, the visual presentation may be fine, but I realized that the logical relationships might not be clear to a spider or an algo.

That's exactly what prompted me to begin using definition lists. The layout can be duplicated using <div>'s or <td>'s as you mention (though the actual <dl> is very elegant itself) but the relationship between the definition term and the definition text will not be established.

It was on a hunch that the spiders and SE algos may assign more importance to a formal <dl> than logically unrelated <div> and <td> presentations. Since the definition list <dl> is a single complete entity comprised of logical sub-components, the importance of relationship is built-in. As far as what (if any) difference this makes to the search engine spiders remains to be seen. I have hopes...

dcheney

12:51 pm on Jun 6, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm still experimenting and haven't posted the new version yet, but the following seems to work pretty well:

<ul style="list-style: disc outside; margin-left: 1em">

Its still the basic ul list but the wasted white space is about 20% of what is was before.

Thanks for all your help!