开发者

How to format text using CSS

I was wondering how can align my text so it will display the way I want it to. Can someone help me display the text like it is in example 2 using CSS?

Here is what my text is doing.

Name: At vero eos et 
accusamus et iusto odio dignissimos d

Here is what I want it do.

Name: At vero eos et 
      accusamus et iusto odio dignissimos d

HTML markup.

<div><p><span>Name:</span> At vero eos et 
      accusamus et iusto odio dignissimos d</p></div>
开发者_如何学运维


<style>
div{
  font-family:"Courier New", Courier, monospace;
  margin-left: 65px;
}
span{
  margin-left: -65px;
} 
</style>

Hopefully you can put a <br /> at the end of each linebreak. If you have PHP, you can use nl2br()

You can see the results and code @ http://jsfiddle.net/Sghym/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜