[英]DD text inline with DT
I'm hoping to be able to use a definition list <dl>
to format something like this:我希望能够使用定义列表
<dl>
来格式化如下内容:
The HTML is something like this: HTML是这样的:
<dl>
<dt>Abandonnement</dt>
<dd>m. an abandonning, quitting, forsaking, leaving off, giving over, laieng open for, prostituting vnto, others; also a proscribing or outlawing.
<dl>
<dt>Abandonnément de raison.</dt>
<dd>a wilfull defection, revolting, or swarming, from reason.</dd>
</dl>
</dd>
</dl>
However, whatever I do, I can't get the <dt>
and <dd>
to look like inline text.但是,无论我做什么,我都无法让
<dt>
和<dd>
看起来像内联文本。 The closest I got was to float the <dt>
left (bolding for emphasis):我得到的最接近的是将
<dt>
向左浮动(加粗强调):
dt {
font-weight: bold;
float:left;
clear: left;
padding-right: 0.5em;
}
https://jsfiddle.net/dL6mkba3/2/ https://jsfiddle.net/dL6mkba3/2/
However, as it is, the line-height
of the <dt>
prevents a natural wrap to the next line, and adjusting the margin-bottom
to something negative causes the <dd>
to be too close when the <dt>
itself wraps.然而,实际上,
<dt>
的line-height
阻止自然换行到下一行,并且将margin-bottom
调整为负值会导致<dd>
在<dt>
自身换行时太靠近。
Is there an easy way to format this with definition lists, or should I just use, say, a <ul>
and forget <dl>
?有没有一种简单的方法可以用定义列表来格式化它,或者我应该只使用,比如说,一个
<ul>
而忘记<dl>
?
Is this a feasible answer?这是一个可行的答案吗?
dl{ padding-left: 1em; text-indent: -1em; } dt{ font-weight: bold; display: inline; } dd { display: inline; margin-left: 0.5em; } .subdef{ display: inline-block; margin-block: 0.2em; padding-left: 0; text-indent: 0; }
<dl> <dt>Abandonnement</dt> <dd>m. an abandonning, quitting, forsaking, leaving off, giving over, laieng open for, prostituting vnto, others; also a proscribing or outlawing. <dl class="subdef"> <dt>Abandonnément de raison.</dt> <dd>a wilfull defection, revolting, or swarming, from reason lorem ipsum dolor sit</dd> </dl> </dd> </dl>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.