2015-07-28 100 views
0

我想格式化一些HTML並將其寫入(用手記在Notepad ++中),這對我來說並不容易。我的語法接近它的需求,但是當文本(主要是AAAA行)傳遞到輔助行時,它會丟失已添加的padding。此外,我認爲這是<p> div標籤,導致它在標題和子數據之間添加一個空格。這是我的HTML,附帶的是我想要的樣子的截圖。將第二行文本設置爲第一個標籤

<p>This would be acceptable:<br> 
<p style="text-indent: 5em;"><strong>Bookbag</strong></p> 
<p style="text-indent: 5em;">Fill it full of your favorite items!</p> 
<p style="text-indent: 5em;"><strong>Extra Clothes</strong></p> 
<p style="text-indent: 5em;">AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</p> 

enter image description here

回答

2

包裹塊元件上的使用padding而非text-indent

<p>This would be acceptable:<br> 
<div style="padding-left:15px;"> 
<p><strong>Bookbag</strong></p> 
<p>Fill it full of your favorite items!</p> 
<p><strong>Extra Clothes</strong></p> 
<p>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</p> 
</div> 

之前只首行文字http://jsfiddle.net/at4Lotno/

0

text-indent增加空間,padding將之前全部內容添加空間

<p>This would be acceptable:<br> 
 
<p style="text-indent: 5em;"><strong>Bookbag</strong></p> 
 
<p style="text-indent: 5em;">Fill it full of your favorite items!</p> 
 
<p style="text-indent: 5em;"><strong>Extra Clothes</strong></p> 
 
<p style="padding-left: 5em;">AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</p>

相關問題