如何设置"框"对于我的文字?

时间:2014-11-27 01:10:33

标签: html text paragraph

我想在我的代码中将文本放在无边框中。原因是我可以让段落文本不会在页面中一直显示并让它们提前开始新的一行。

2 个答案:

答案 0 :(得分:1)

我很抱歉给出了一个令人难以置信的模糊答案,但它只是像你的问题一样模糊。如果您需要详细信息,请修改您的问题并描述最终结果。无论如何:



div {
  margin: 10px 0;
  }

p {
  margin: 0 50px;
}

<body>

  <div>Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size.</div>

  <p>Shorter paragraph size. Shorter paragraph size. Shorter paragraph size. Shorter paragraph size. Shorter paragraph size. Shorter paragraph size. Shorter paragraph size.
  </p>

  <div>Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size.</div>

</body>
&#13;
&#13;
&#13;

我希望这有帮助!

答案 1 :(得分:1)

这可以通过在css中为<p>设置%宽度或在div中使用自定义样式来完成,有关示例,请参阅http://jsfiddle.net/sycoinc/k8dgxkLs/