开发者

CSS second-line indent not working

Page in question: http://www.rjlacount.com/public/lander/

I'm probably just doing something stupid, but I'm trying to indent the second line of wrapping text inside the form (with "Your account: test@test.com" at the top) and I can't seem to get anything to开发者_如何学C work.

I would think the solution is:

form span {padding-left:1.5em;text-indent:-1.5em;}

but this only seems to indent the first line of each section.

Another look at this would be much appreciated, thanks!


If the element is inline it will indent the first line, otherwise if it's a block element it will indent the rest of the lines, which is just like Briguy37 said, since that's the difference between DIV and SPAN. I just wanted to clear out that it's not a "problem with span".


For some reason, this works with a DIV, but not with a SPAN. Not really sure why, but here's a fiddle with the same CSS for both.


spans are handled as inline elements.

Considering them as actual characters helps to conceptualize the changes. A space after a span is retained because it's like a space between characters. You adjust height by line-height rather than simply height. etc etc

Usually if this is causing a problem you can just use a div and set display:inline-block; if you need horizontal alignment.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜