自动缩进包装的文本 [英] Automatically indent wrapped text

查看:34
本文介绍了自动缩进包装的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有点菜鸟,但我基本上希望文本在换行时自动缩进.所以,而不是:

Bit of a noob here, but I basically want text to automatically indent when it's wrapped. So instead of:

Peter piper picked a peck
of pickled peppers.

应该是:

Peter piper picked a peck
    of pickled peppers.

这是我试过的:

span.profile{ display:block; text-indent: -35px; /*this pulls the first line to the left*/ padding-left:35px; /*this pushes the paragraph to the right*/ padding-right:0px; text-align:justify; }

此后,我在整个文本周围添加了 span class="profile" 标记,但问题是我希望它在每次换行后重置".有没有办法让它这样做?

After this, I add the span class="profile" tag around the entire text, but the problem is that I want it to "reset" after each line break. Is there a way to make it do that?

感谢您的帮助!

推荐答案

我创建了一个小的 JSFiddle.

这是您要找的吗?

div {
    width: 500px;
}
div p {
    text-indent: -20px;
    padding-left: 25px;
}

这看起来像你对 CSS 所做的,但我为每个段落都做了.

This looks like what you had for CSS, but I have it doing it for each paragraph.

告诉我.

这篇关于自动缩进包装的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆