2013-04-02 26 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

相关问题