带有内联对的定义列表 [英] Definition list with inline pairs

查看:111
本文介绍了带有内联对的定义列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个术语定义对的定义列表,每个对存在于一条单独的行上。我尝试过 dt s和 dd s display:inline ,但是我失去了对之间的换行符。



示例:


$ b如何确定每一对(每个单独的术语/定义) $ b

 < dl> 
< dt>第1项< / dt>< dd> Def 1< / dd>
< dt>第2项< / dt>< dd> Def 2< / dd>
< / dl>

产生:

 code> Term 1 Def 1 
Term 2 Def 2

它们内联将是:

  dt,dd {display:inline;} 
/ pre>

产生:

  2 

...这不是我想要的>

解决方案

尝试:

  dt ,dd {float:left} 
dt {clear:both}

dt dd ,如果你想要更多的空间。


I'm trying to create a definition list of term-definition pairs, each pair existing on a single, separate line. I've tried making dts and dds display:inline, but then I lose the line breaks between the pairs. How do I make sure I have a line for each pair (and not for each individual term/definition)?

Example:

<dl>
<dt>Term 1</dt><dd>Def 1</dd>
<dt>Term 2</dt><dd>Def 2</dd>
</dl>

yielding:

Term 1 Def 1
Term 2 Def 2

The CSS for making them inline would be:

dt,dd{display:inline;}

yielding:

Term 1 Def 1 Term 2 Def 2

...which is not what I want (line breaks between pairs missing).

解决方案

Try this:

dt, dd { float: left }
dt { clear:both }

Add margin-bottom to dt dd if you'd like more space between them..

这篇关于带有内联对的定义列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆