开发者

How to format text using CSS

开发者 https://www.devze.com 2023-01-08 06:49 出处:网络
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?

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

精彩评论

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