html - 对齐段落文本 HTML

标签 html css

如何证明这段文字的合理性?? 我已经尝试并搜索了好几天才能找到如此简单易用的东西..

例如:

HTML:

<div id="justify">
   <p>I just want this to justify..</p>
</div>

CSS:

#justify {
    width: 100%;
    background: #D33;
}

#justify p {
    margin: 0 auto;
    max-width: 70%;
    list-style: disc outside none;
    text-align: justify;
    display: list-item;
    background: #ccc;
    }

在 JSFiddle 上:

http://jsfiddle.net/xDqwF/

如有任何帮助,我们将不胜感激。

最佳答案

#justify p:after {
  content: "";
  display: inline-block;
  width: 100%;
}

通过一些 HTML 技巧,这应该可以工作。很久以前,当我遇到类似问题时,我在一篇博客文章中发现了它。在 JSFiddle 上查看

http://jsfiddle.net/xDqwF/2/

关于html - 对齐段落文本 HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21668120/

相关文章:

jquery - 如何在 jQuery 中固定页眉和页脚并在其中使用 stickytableheaders 时如何避免 Windows 默认水平滚动条?

CSS:怎么说 .class:last-of-type [类,而不是元素!]

jquery - Internet Explorer 和 Opera 中的不透明度问题

html - 如何以正确的顺序正确对齐 CSS 卡(水平,而不是垂直)

css - 无法修复 iframe 高度

Javascript 警报弹出表单

jQuery 拖动滚动禁用

javascript - html/javascript中三个图像的随机位置

html - 我如何让我的 Opera 浏览器运行鼠标指针

css - 在某些网页中,页脚在 IE 9 浏览器中显示不正确