CSS向右浮动... [英] CSS float right.....

查看:101
本文介绍了CSS向右浮动...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一个按钮元素浮动到右侧,但它没有按我期望的那样工作.

这没有"float:right;"

http://i.imgur.com/wSQxs.png [
http://i.imgur.com/QfEl2.png [

I''m trying to float a button element to the right and it isn''t working as I would expect.

This is without "float:right;"

http://i.imgur.com/wSQxs.png[^]


And then it goes down to the next line when I add "float:right;".

http://i.imgur.com/QfEl2.png[^]


How would I make the button dock on the very right side of the gray box?

推荐答案

您可以使用此

you can use this

<div style="width: 50%;">
                    <div style="float: none;">
                        your text comes here
                    </div>
                    <div style="float: left;">
                        <input type="text" id="txtid" />
                    </div>
                    <div style="float: right;">
                        <input type="button" value="okay" />
                    </div>
                </div>


这在我运行示例页面时按预期工作:
This works as expected when I run the sample page:
<asp:Panel runat="server" ID="textPanel" BorderColor="Black" BorderWidth="2">
 <label>Dock float</label>
 <input style="float: right;" type="button" value="PressMe" />
</asp:Panel>


虽然,我确实找到了VS设计器,将它作为您的图像显示在下一行中,但是运行我的应用程序时,一切符合预期.试试吧.


Though, I did find VS designer showing it on the next line as your image, but things were as per expectation when I run the app. Try out.


这篇关于CSS向右浮动...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆