【问题标题】:Indent an entire paragraph?缩进整个段落?
【发布时间】:2011-09-18 04:10:29
【问题描述】:

我有一个常见问题页面的代码设置,如下所示:

<p><strong>This Is A Question</strong></p>
<p><strong>Answer.</strong> This is the content of the answer, and I am going to keep 
typing until it kicks to a new line.</p>

我确实注意到,当它通过浏览器显示时,新行未与答案内容的开头对齐。从左对齐。我也知道不要指望 HTML 做这样的事情,必须要问的是。遇到“缩进”此文本本身时,我有哪些选择?

任何帮助将不胜感激!

【问题讨论】:

  • 这里是a jsfiddle of your markup。你的问题描述不是很清楚。你到底想看什么?
  • @Alex - 这是我的标记的更新 jsfiddle。 jsfiddle.net/NyUYv/1 。你现在看到了吗?文本位于“答案”下,我想让它做的是让答案的实际内容缩进,不管它有多长,所以每一行都从答案内容的开头开始。而不是一直走到“答案”这个词下的左边。

标签: html text xhtml indentation paragraph


【解决方案1】:

Nicole Sullivan's css .media element 的启发,您可以查看two column solution 对您的jsfiddle 的更新。

【讨论】:

    【解决方案2】:

    我想这就是你想要的:

    <p><strong>This Is A Question</strong></p>
    <p><strong style="float:left">Answer.</strong> 
    <div style="display:inline-table;float:right">This is the content of the answer, and I am going to keep typing until it kicks to a new line.</div></p>
    

    编辑:从头开始,它适用于 FF + IE,但不适用于 chrome

    【讨论】:

    • 感谢兄弟的尝试。
    【解决方案3】:

    尝试在 CSS 中为段落的 div 使用负填充。 通常跨 webkit 和 gecko 工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-13
      相关资源
      最近更新 更多