2015-03-02 64 views
0

假設我在foo.html文件中像這樣的文字:我可以使用「原樣」文本製作css div嗎?

All the World's a Stage 

All the world's a stage, 
And all the men and women merely players; 
They have their exits and their entrances, 
And one man in his time plays many parts, 

His acts being seven ages. At first, the infant, 
Mewling and puking in the nurse's arms. 
Then the whining schoolboy, with his satchel 

And shining morning face, creeping like snail 
Unwillingly to school. And then the lover, 
Sighing like furnace, with a woeful ballad 
Made to his mistress' eyebrow. 

注意空格和換行。我可以把它放到div,並保持它與CSS一樣嗎?

All the World's a Stage All the world's a stage, And all the men and women merely players; They have their exits and their entrances, And one man in his time plays many parts, His acts being seven ages. At first, the infant, Mewling and puking in the nurse's arms. Then the whining schoolboy, with his satchel And shining morning face, creeping like snail Unwillingly to school. And then the lover, Sighing like furnace, with a woeful ballad Made to his mistress' eyebrow. 

我想是非常接近<pre>標籤的行爲,我認爲:不是所有文本作爲在一起的時候,你把一個HTML頁面它的發生。

+2

爲什麼不使用預標籤呢? – 2015-03-02 17:31:15

回答

-2

嗯..像一個<pre>標籤的行爲,做一個<pre>標籤做這項工作。也許是<pre>標籤? 只是在開玩笑與諷刺

<pre> 
 
All the World's a Stage 
 

 
All the world's a stage, 
 
And all the men and women merely players; 
 
They have their exits and their entrances, 
 
And one man in his time plays many parts, 
 

 
His acts being seven ages. At first, the infant, 
 
Mewling and puking in the nurse's arms. 
 
Then the whining schoolboy, with his satchel 
 

 
And shining morning face, creeping like snail 
 
Unwillingly to school. And then the lover, 
 
Sighing like furnace, with a woeful ballad 
 
Made to his mistress' eyebrow. 
 
</pre>

<pre>標籤定義預格式化文本。閱讀更多here

你有什麼理由不能使用它?

+0

如果它像鴨子一樣嘎嘎叫...... – BoltClock 2015-03-02 17:42:38

相關問題