【问题标题】:Bulleted List with bullet flush left and Hanging Indent项目符号列表,项目符号向左冲洗和悬挂缩进
【发布时间】:2015-02-07 17:01:34
【问题描述】:

我正在寻找用 html 或 markdown 对项目符号列表进行编码的正确方法,项目符号向左对齐,项目符号后有一个制表符空间,项目符号行正下方有一个悬挂缩进。我已经尝试将它与空格和各种列表一起破解,但没有什么好看的。有什么建议吗?

我试图让它看起来像这样:

这是我的清单

∙  第一行
第二行

【问题讨论】:

  • “项目符号后的制表符”是什么意思?
  • 你能发布你尝试过的代码,并解释什么不工作吗?

标签: html markdown indentation


【解决方案1】:

这需要一个两部分的解决方案:

  1. 使用 Markdown 在语义上表示多行列表项。

    根据“第二行”应该是一个新段落还是一个新行,您可以这样做

    * Line one
    
    ␣␣␣␣New paragraph
    

    * Line one␣␣
    New line
    

    代表一个空格。

  2. 按照您的意愿设置此列表的样式。项目符号前后的间距纯粹是为了美观,不能在 Markdown 中表示。

    CSS 样式应该这样做:

    ul {
      /* Make bullet left-flush, value chosen by experimentation */
      padding-left: 10px;
    }
    
    ul li {
      /* Add padding to list item, which amounts to space between the
         bullet and the text */
      padding-left: 1.5em;
    }
    <!-- Generated by Markdown -->
    <ul>
      <li>Line one<br>
        New line</li>
    </ul>

【讨论】:

  • 谢谢你,克里斯!您的两部分方法比我使用空间的方法要好得多,并且在所有设备上都能完美流畅。
【解决方案2】:

ul {
  /* Make bullet left-flush, value chosen by experimentation */
  padding-left: 10px;
}

ul li {
  /* Add padding to list item, which amounts to space between the
     bullet and the text */
  padding-left: 1.5em;
}
<!-- Generated by Markdown -->
<ul>
  <li>Line one<br>
    New line</li>
</ul>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-09
    • 1970-01-01
    • 2016-03-17
    相关资源
    最近更新 更多