简体   繁体   English

带 DT 的 DD 文本

[英]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>

连接<dt>和</dt><dd>在<div id="text_translate"><p>我想创建页面 header 并且我需要在一行中连接 dt 和 dd 这是我的视图代码:</p><pre> &lt;div style="margin-left:100px"&gt; &lt;hr /&gt; &lt;dl class="horizontal"&gt; &lt;dt&gt;@Html.DisplayNameFor(model =&gt; model.labCashView.Patient_Name)&lt;/dt&gt; &lt;dd&gt;@Html.DisplayFor(model =&gt; model.FirstOrDefault().labCashView.Patient_Name)&lt;/dd&gt; &lt;dt&gt;@Html.DisplayNameFor(model =&gt; model.labCashView.Patient_No)&lt;/dt&gt; &lt;dd&gt;@Html.DisplayFor(model =&gt; model.FirstOrDefault().labCashView.Patient_No)&lt;/dd&gt; &lt;dt&gt;@Html.DisplayNameFor(model =&gt; model.labCashView.SEX)&lt;/dt&gt; &lt;dd&gt;@Html.DisplayFor(model =&gt; model.FirstOrDefault().labCashView.SEX)&lt;/dd&gt; &lt;dt&gt;@Html.DisplayNameFor(model =&gt; model.labCashView.AGE)&lt;/dt&gt; &lt;dd&gt;@Html.DisplayFor(model =&gt; model.FirstOrDefault().labCashView.AGE)&lt;/dd&gt; &lt;dt&gt;@Html.DisplayNameFor(model =&gt; model.labCashView.order_number)&lt;/dt&gt; &lt;dd&gt;@Html.DisplayFor(model =&gt; model.FirstOrDefault().labCashView.order_number)&lt;/dd&gt; &lt;/dl&gt; &lt;/div&gt;</pre><p> output 现在标题在第一行,数据在第二行:</p><p> 患者姓名</p><p>萨米阿里</p><p>患者_否</p><p> 345676</p><p> 但我需要这样的 output:</p><p> Patient_Name 萨米·阿里</p><p>患者_编号 345676</p><p> 等等,我该怎么做?</p></div><table></table></dd> - concatenate <dt> with <dd> in <table>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Dt 和 dd 内联在 outlook email 正文中不起作用 - Dt and dd inline not work in outlook email body CSS表单样式帮助内联dt / dd元素 - CSS form styling help inline dt/dd elements "具有多个 dd 元素到 1 个 dt 元素的内联定义列表" - Inline definition list with multiple dd elements to 1 dt element Python和BeautifulSoup,通过查找dt文本查找并打印dd列表项 - Python and BeautifulSoup, find and print dd list items by finding the dt text DT 右侧有多个 DD? - DT with multiple DD on the right? 连接<dt>和</dt><dd>在<div id="text_translate"><p>我想创建页面 header 并且我需要在一行中连接 dt 和 dd 这是我的视图代码:</p><pre> &lt;div style="margin-left:100px"&gt; &lt;hr /&gt; &lt;dl class="horizontal"&gt; &lt;dt&gt;@Html.DisplayNameFor(model =&gt; model.labCashView.Patient_Name)&lt;/dt&gt; &lt;dd&gt;@Html.DisplayFor(model =&gt; model.FirstOrDefault().labCashView.Patient_Name)&lt;/dd&gt; &lt;dt&gt;@Html.DisplayNameFor(model =&gt; model.labCashView.Patient_No)&lt;/dt&gt; &lt;dd&gt;@Html.DisplayFor(model =&gt; model.FirstOrDefault().labCashView.Patient_No)&lt;/dd&gt; &lt;dt&gt;@Html.DisplayNameFor(model =&gt; model.labCashView.SEX)&lt;/dt&gt; &lt;dd&gt;@Html.DisplayFor(model =&gt; model.FirstOrDefault().labCashView.SEX)&lt;/dd&gt; &lt;dt&gt;@Html.DisplayNameFor(model =&gt; model.labCashView.AGE)&lt;/dt&gt; &lt;dd&gt;@Html.DisplayFor(model =&gt; model.FirstOrDefault().labCashView.AGE)&lt;/dd&gt; &lt;dt&gt;@Html.DisplayNameFor(model =&gt; model.labCashView.order_number)&lt;/dt&gt; &lt;dd&gt;@Html.DisplayFor(model =&gt; model.FirstOrDefault().labCashView.order_number)&lt;/dd&gt; &lt;/dl&gt; &lt;/div&gt;</pre><p> output 现在标题在第一行,数据在第二行:</p><p> 患者姓名</p><p>萨米阿里</p><p>患者_否</p><p> 345676</p><p> 但我需要这样的 output:</p><p> Patient_Name 萨米·阿里</p><p>患者_编号 345676</p><p> 等等,我该怎么做?</p></div><table></table></dd> - concatenate <dt> with <dd> in <table> dt dd背景对齐 - dt dd backgrounds alignement <dt> 和 <dd> 未附加 - <dt> and <dd> not appended 如何设置dt和dd在同一列中并且都组合在一起的dl标签样式 - how to style dl tag that dt and dd are in same column and both combinely inline 样式DT浮动DD左侧 - Styling DT to float left of DD
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM