467,920 Members | 1,204 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,920 developers. It's quick & easy.

how to not insert a new line after <dt> in a <dl> ?

I think browsers do it pretty much by default. How can you avoid that?

It just doesn't look right/pretty for short definitions and also how
can you not indent the whole <dd> so that in stead of looking like
this:

<code>
_ _ _ term: def def def def def def ...
_ _ _ _ _ _ def def def def def def ...
</code>

it would look like:

<code>
_ _ _ term: def def def def def def ...
_ def def def def def def def def def ...
</code>

That is it would not indent the whole def to the right passed the term

Thanks
otf

Jan 29 '06 #1
  • viewed: 6076
Share:
13 Replies
Els
onetitfemme wrote:

[subjectline: How to not insert a new line after <dt> in a <dl>?]
I think browsers do it pretty much by default. How can you avoid that?
In your stylesheet:
dt{float:left;clear:left;}
It just doesn't look right/pretty for short definitions and also how
can you not indent the whole <dd> so that in stead of looking like
this:

<code>
_ _ _ term: def def def def def def ...
_ _ _ _ _ _ def def def def def def ...
</code>

it would look like:

<code>
_ _ _ term: def def def def def def ...
_ def def def def def def def def def ...
</code>

That is it would not indent the whole def to the right passed the term
In your stylesheet:
dd{margin-left:0;}
Thanks


You're welcome :-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jan 29 '06 #2
onetitfemme wrote:
I think browsers do it pretty much by default.
Browsers do "it" pretty much by default? One of the oddest statements
about doing "it" I've seen. If you didn't mean "it", you should have
specified what you mean. (Note: it is bad practice to refer to a heading
in the copy text of a message, article, web page, or anything.)
How can you avoid that?
If "that" means means "a new line after <dt>", then there's nothing to
be avoided. There is no new line. Just some margin or padding, which may
look like a line to an untrained eye, especially if you don't pay
attention to the fact that there is no spoo... I mean line. Can you have
a line of text without any text?

If you mean the vertical spacing, i.e. the vertical margin or padding,
then surely you know how to work with them in CSS. What exactly did you
try? URL?

On the other hand, which browser uses a default bottom margin or padding
for <dt>? You seem to be asking for help with a vaguely described
problem that does not exist.

Or did you mean you don't want even a line break after <dt>, i.e. you'd
like to have the definition start at the same line? That would be odd,
and your sketchy example does not support this idea.

The simple answer is "don't use <dl>", and it's mostly correct, since
mostly people have not got a list of _definitions_ (i.e., _terms_ with
their _definitions_) when they use <dl>.
It just doesn't look right/pretty for short definitions and also how
can you not indent the whole <dd> so that in stead of looking like
this:

<code>
_ _ _ term: def def def def def def ...
_ _ _ _ _ _ def def def def def def ...
</code>
Well, it has no new line. What _is_ the problem? And what's that <code>
stuff there?
it would look like:

<code>
_ _ _ term: def def def def def def ...
_ def def def def def def def def def ...
</code>

That is it would not indent the whole def to the right passed the term


This is far too vague. Why don't you post a URL and specify exactly what
you would like to change in the default appearance (on some browsers)?

Besides, the <dl> element is so widely abused for mixed name/value pairs
that contain no definitions whatsoever that it's not particularly useful
semantically. If you add the observed fact that its default renderings
have idiosyncracies and are difficult to tune with CSS, the question
arises why you use it.

Using just e.g.

<p><dfn>Term:</dfn> def def def...</p>

might be a better starting point. You would not have much unexpected and
unpredictable default rendering, and you could play with margin-left and
text-indent for the paragraphs. Of course you could also use a <ul>
instead of a sequence of <p> elements, but if the definitions are long,
simple paragraphs might be more natural.
Jan 29 '06 #3
On Sun, 29 Jan 2006 14:09:36 +0100, onetitfemme
<on*************@yahoo.com> wrote:
It just doesn't look right/pretty for short definitions and also how
can you not indent the whole <dd> so that in stead of looking like
this:

<code>
_ _ _ term: def def def def def def ...
_ _ _ _ _ _ def def def def def def ...
</code>

it would look like:

<code>
_ _ _ term: def def def def def def ...
_ def def def def def def def def def ...
</code>


I set up an example (only tested it in Opera) at
<URL:http://www.pretletters.net/_test/styling_definition_lists.html>. That
could help you.


--
______PretLetters:
| weblog | http://www.pretletters.net/_private/weblog.html |
| webontwerp | http://www.pretletters.net/html/webontwerp.html |
|zweefvliegen | http://www.pretletters.net/html/vliegen.html |
Jan 29 '06 #4
On Sun, 29 Jan 2006, Jukka K. Korpela wrote:
Besides, the <dl> element is so widely abused for mixed name/value
pairs that contain no definitions whatsoever that it's not
particularly useful semantically.


I think we agree on the observations; but I'm not sure that everyone
has to draw the same conclusion from it. The HTML/4.01 specification
already suggests a plausible application of the markup which quite
obviously is not a "definition":

||Another application of DL, for example, is for marking up dialogues,
||with each DT naming a speaker, and each DD containing his or her
||words.

which would fail the strict semantic test.

Given that many of the uses of <dl> that are observed "in the field"
(excluding those which are obviously so far adrift as to be bogus)
can be interpreted constructively as groups of "term and values", even
if they are beyond the borderline as regards your personal standards
of "definition", I think it's possible to accept a rather wider
interpretation of this markup for practical purposes.

You may parse that as me saying "since so many others are abusing it,
then I may as well abuse it myself", but I'd prefer to apply a more
positive and constructive interpretation than that.

I'm not saying the HTML/4.01 spec is always right - indeed I know that
in some places it effectively contradicts itself - but in this case I
think its acceptance of a wider semantic for <dl> isn't so bad as your
consistently expressed views about it.

IMHO and YMMV, of course.
Jan 29 '06 #5
C'mon Jukka, I think you understood me just fine

I think I will be going for your suggestion (as coocked by me ;-))
looking more like:

<code>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
dir="ltr">

<head>
<title>list test</title>
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<style type="text/css">

div.float {
float: left;
margin-left: 10px;
margin-right: 10px;
}

div.float p { text-align: center; }

span.trm {
text-indent: 0.50em;
font-weight: bold;
}

ul li p.def {
text-indent: 0.00em;
margin-top: 0px;
margin-down: 0px;
}

p{
text-indent: 1.50em;
margin-top: 0px;
margin-down: 0px;
}

</style>
</head>

<body>

<span style="horizontal-align: center;">
<div> <!-- float container -->
<div class="float">
<img src="image1.gif" width="100" height="100" alt="image 1" /><br />
<p>caption 1</p>
</div>

<div class="float">
<img src="image2.gif" width="100" height="100" alt="image 2" /><br />
<p>caption 2</p>
</div>

<div class="float">
<img src="image3.gif" width="100" height="100" alt="image 3" /><br />
<p>caption 3</p>
</div>

<!-- clearing floating container -->
<div style="clear: both;"></div>
</div>
</span>

<hr />

<ul>
<li><p class="def"><span class="trm">Term 1</span>: def1 ...</p></li>
<li><p class="def"><span class="trm">Term 2</span>: def2 ...</p></li>
<li><p class="def"><span class="trm">Term 3</span>: def3 ...</p></li>
</ul>

<p>This is a freely standing paragraph</p>

<html>
</code>

I still wasn't able to center the three images on the top even if
floating to the left

I you go "div.float { float: center; }" you would destroy the
floating
(Note: it is bad practice to refer to a heading in the copy text of a message, article, web page, or anything.)

However, my postwas very short; anyone could get what I meant with
"it" ;-)

Thanks
otf

Jan 29 '06 #6
"onetitfemme" <on*************@yahoo.com> wrote:
C'mon Jukka, I think you understood me just fine
No I didn't, and I refuse to be on a first-name basis with an anonymous
poster.
I think I will be going for your suggestion (as coocked by me ;-))


You misspelled "misunderstood". Your tag sallad does not tell what you are
trying to accomplish, and since you refuse to post the URL, you refuse to be
helped. HAND.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jan 29 '06 #7
onetitfemme wrote :
I think browsers do it pretty much by default. How can you avoid that?

If a wide majority of browsers do "it" by default, then is it in your
best interests as a web author to modify "it", to code against "it"?
That is assuming of course that you are using <dt> and <dl> accordingly
to begin with.
It just doesn't look right/pretty for short definitions
Is a short definition still implying a definition term and definition
data? If so, then what's wrong with applying the best semantic markup to
a page situation? Looking right/pretty does not apply and should not
apply; best semantic markup should apply.
and also how can you not indent the whole <dd> so that in stead of looking like
this:

<code>
_ _ _ term: def def def def def def ...
_ _ _ _ _ _ def def def def def def ...
</code>

it would look like:

<code>
_ _ _ term: def def def def def def ...
_ def def def def def def def def def ...
</code>


dt { display: compact; }
dd { margin-left: 0; }

Gérard
--
remove blah to email me
Jan 29 '06 #8
Gérard Talbot wrote :
dt { display: compact; }
dd { margin-left: 0; }


Even better:

dt {font-weight: bolder; display: run-in;}
dd {margin-bottom: 0;}

http://www.w3.org/TR/CSS21/visuren.html#run-in

Gérard
--
remove blah to email me
Jan 29 '06 #9
On Sun, 29 Jan 2006 23:01:08 +0100, Gérard Talbot
<ne***********@gtalbot.org> wrote:
<code>
_ _ _ term: def def def def def def ...
_ def def def def def def def def def ...
</code>

dt { display: compact; }
dd { margin-left: 0; }


Doesn't seem to do anything. At least it doesn't create a definition list
looking like the 'ascii art' example provided by OP. I tried and added
these styles to my example page. Go see
<URL:http://www.pretletters.net/_test/styling_definition_lists.html>.
You're the third example in that page.

Gérard
--
remove blah to email me


Your sig sep is broken. And before you start telling me that mine is too,
it has something to de with Thunderbird 1.5 you use. It is buggy somehow
with signature blocks. Don't ask me why/how, 'cause I don't know any more.

--
______PretLetters:
| weblog | http://www.pretletters.net/_private/weblog.html |
| webontwerp | http://www.pretletters.net/html/webontwerp.html |
|zweefvliegen | http://www.pretletters.net/html/vliegen.html |
Jan 29 '06 #10
On Sun, 29 Jan 2006 23:25:09 +0100, Gérard Talbot
<ne***********@gtalbot.org> wrote:
Gérard Talbot wrote :
dt { display: compact; }
dd { margin-left: 0; }


Even better:

dt {font-weight: bolder; display: run-in;}
dd {margin-bottom: 0;}

http://www.w3.org/TR/CSS21/visuren.html#run-in


Which does indeed work in Opera, but doesn't in Internet Exlorer (if you
care about that), but also doesn't seem to work in Firefox1.5 (which is a
bit more worrying).

Again:
<URL:http://www.pretletters.net/_test/styling_definition_lists.html>, this
time the fourth example.
--
______PretLetters:
| weblog | http://www.pretletters.net/_private/weblog.html |
| webontwerp | http://www.pretletters.net/html/webontwerp.html |
|zweefvliegen | http://www.pretletters.net/html/vliegen.html |
Jan 29 '06 #11
I think Yucca's proposal is best and it will be the one I will be
using. Browsers out there are very "free" indeed interpreting something
as simple as a the layout of a list (which IMHO shouldn't be much of a
deal).

From the browsers I have access to right now:
._ Gecko/20050911 Firefox/1.0.6 does NOT
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050911
Firefox/1.0.6 (Debian package 1.0.6-5)
..
._ Konqueror 3.4.1 (Using KDE 3.4.1) takes is just find
._ Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8) Gecko/20051111
Firefox/1.5 takes it OK also
..
I still had a question on how to center, as a group, say, three
pictures that have been laid out floating to the left each. Here is a
link to a demo page:
..
http://www.geocities.com/tekmonk2005...st_test00.html
..
Also Yucca, bro, take it easy. Here, in public on line fora, people's
names are "mingo", "snow_white", "onetitfemme" or whatever they feel
like going by. I don't think that it really matters. Thing is that the
immediacy that the Internet gives us is good, I think. I wouldn't know
of any other way to treat you than your screen name and I sincerely
wondered what your qualms where about.
..
otf

Jan 30 '06 #12
onetitfemme wrote:
.
I still had a question on how to center, as a group, say, three
pictures that have been laid out floating to the left each.
.

Then why did you float them left?
You could put the images in a div, make the div just wide enough for the
images, and center the div. No floating involved.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jan 31 '06 #13
You misspelled "salad."

Yucky, http://www.yuckycorpulent.com

Jan 31 '06 #14

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Peter Crom | last post: by
6 posts views Thread by The Plankmeister | last post: by
4 posts views Thread by Andre Majorel | last post: by
25 posts views Thread by Shannon Jacobs | last post: by
16 posts views Thread by Ian Rastall | last post: by
3 posts views Thread by Andy Dingley | last post: by
9 posts views Thread by David Trimboli | last post: by
nathj
5 posts views Thread by nathj | last post: by
3 posts views Thread by ddailey | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.