2013-04-02 24 views
1

我有一個包含2個項目的簡短有序列表。在第二項內,我想在右側放置一個按鈕。 CSS給我帶來了麻煩,所以我在這裏發佈它,希望有更多的技術人員能夠提供幫助。如何在列表元素中放置一個按鈕?

這裏的標記:

<ol> 
    <li>Go here to <a href="review.aspx">perform an internal review</a>.</li> 
    <li>When satisfied with the internal review, click the button on the right and then go to the Staging environment for a final review.<span style="width: 25%; display: block;float: right;" ><asp:Button runat="server" runat="server" ID="StageChanges" Text="Stage Changes" OnClick="StageChanges"/></span></li> 
</ol> 

理想我想按鈕與列表元素2.文本列表元素2應適當地包裹內聯。現在按鈕在第二個列表元素下面。

我試了幾個變化,但似乎沒有任何工作,因爲我想。一個變體包括指定第二個列表元素的寬度,但是這會從顯示中移除數字2(或將其移到按鈕的前面)。

預先感謝您!

編輯添加圖片: enter image description here

+0

我剛剛試過的代碼,你在這裏發佈的標記,並沒有像你說的,你可以在這裏看到它http://jsfiddle.net/bZkm5/ –

+0

@GabrielMonteiroNepomuceno我沒有看到在你的按鈕鏈接。 – Mark

+0

必須刪除 hurrtz

回答

2

當我裁剪你的代碼了一點它的工作出色。按鈕被放置在第二列表元素的內聯:

<li> 
    When satisfied with the internal review, click the button on the right and then go to the Staging environment for a final review. 
    <button>Stage Changes</button> 
</li> 

記住按鈕是從它包裝內容獲取其文本,而不是從文本屬性那幾個表單元素之一。

+0

我添加了一張圖片來展示我正在發生的事情。這是你看到它的方式嗎? – Mark

+1

http://jsfiddle.net/4Ke2x/是我的看法:) – hurrtz

+0

好的,我怎樣才能得到它,所以第二個列表元素基本上是2列,按鈕是唯一的第二列。 – Mark

1

添加CSS列表項

ol li{ 
display: inline-block; 
} 
+0

我試圖添加,作爲內聯樣式,但它沒有改變任何東西。我添加了一張圖片來展示正在發生的事情。 – Mark

相關問題