2012-09-23 69 views
0

我正在使用ul和li標記顯示文本。ul標記中的對齊文本

<ul class="archive-item-list-pt"> 
    <li><a href="/blogs/2012/9/22/reading-and-writing.html">Reading and writing</a></li> 
    <li><a href="/blogs/2012/9/22/celebrations-arent-what-they-used-to-be.html">Celebrations aren’t what they used to be</a></li> 
</ul> 

如果文本很長,它顯示(光盤)下面的文本。我想對齊第一行和第二行。

+0

你試過'list-style-position:outside;'? – OneMore

+0

是的,它正在刪除(list-style-type:square)。 –

回答

0

您應該設置list-style-positionoutside

.archive-item-list-pt { 
    list-style-position: outside; 
} 

這裏的小提琴:http://jsfiddle.net/qMM5x/


或者使用速記屬性:

.archive-item-list-pt { 
    list-style: square outside; 
} 

這裏的小提琴:http://jsfiddle.net/nfYVP/

+0

當我使用它時,它不顯示列表樣式類型:square.I要顯示列表樣式類型也是 –

+0

@RohitSharma,這是因爲,他沒有將其定義爲方塊,只需添加列表樣式:在宣言上的廣場。 – Starx

+0

@RohitSharma - 嘗試使用速記屬性。 –