twitter-bootstrap dd 标签中的 Bootstrap 缩进没有按预期工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26898029/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 21:50:54  来源:igfitidea点击:

Bootstrap indenting within dd tags not working as expected

htmlcsstwitter-bootstrapindentationdd

提问by Dave Gordon

I am designing (wish I was a designer) a webpage for a charity - the constitution which is basically a list of headers and information I decided to do in a tag. However, I can not seem to get the elements to behave the way I want them with sub items being indented further than their parent elements.

我正在为一个慈善机构设计(希望我是设计师)一个网页 - 章程基本上是我决定在标签中做的标题和信息的列表。但是,我似乎无法让元素按照我希望它们的方式运行,而子项的缩进比它们的父元素更远。

Incorrect Indentation

不正确的缩进

As you can see Item 4 is fine, yet Item 4.1 should be indented further, and any sub-items (4.1.1) from that indented further again.

如您所见,第 4 项很好,但第 4.1 项应该进一步缩进,并且该子项 (4.1.1) 中的任何子项 (4.1.1) 再次缩进。

I tried to use css and create two text-indent-n styles like shown below

我尝试使用 css 并创建两个 text-indent-n 样式,如下所示

.text-indent-4{
    text-indent: 50px;
}

.text-indent-8{
    text-indent: 100px;
}

It makes no difference when applied like this:

像这样应用时没有区别:

<dt data-toggle="tooltip" data-placement="top" title="Register of members">Register of members</dt>
  <dd>17. The board must keep a register of members, setting out </dd>
  <dd  class="text-indent-4">17.1   for each current member:</dd>
  <dd  class="text-indent-8">17.1.1 their full name and address; and</dd>
  <dd  class="text-indent-8">17.1.2 the date on which they were registered as a member of the organisation; </dd>
  <dd  class="text-indent-4">17.2   for each former member - for at least six years from the date on he/she ceased to be a member:</dd>
  <dd  class="text-indent-8">17.2.1 his/her name; and</dd>
  <dd  class="text-indent-8">17.2.2 the date on which he/she ceased to be a member. </dd>
  <dd>18    The board must ensure that the register of members is updated within 28 days of any change:</dd>
  <dd  class="text-indent-4">18.1   which arises from a resolution of the board or a resolution passed by the members of the organisation; or </dd>
  <dd  class="text-indent-4">18.2   which is notified to the organisation.  </dd>
  <dd>19    If a member or charity trustee of the organisation requests a copy of the register of members, the board must ensure that a copy is supplied to him/her within 28 days, providing the request is reasonable; if the request is made by a member (rather than a charity trustee), the board may provide a copy which has the addresses blanked out.</dd>

So the questions are:

所以问题是:

1) How can I get each sub-item of a <dl>to indent 2) Is their a way of getting it to calculate automatically the indentation for the <dd>or will each have to be specified?

1) 我怎样才能让 a 的每个子项目<dl>缩进 2) 他们是一种让它自动计算缩进的方法<dd>还是每个都必须指定?

回答by Dave Gordon

The simple remedy to this is to surround the sub-items with <ul></ul>tags this will indent the sub-items as required.

对此的简单补救方法是用<ul></ul>标签包围子项目, 这将根据需要缩进子项目。

Thanks for the edit

感谢您的编辑