CSS - 将div对齐到文本框的右侧 [英] CSS - Align div to the right of text box

查看:309
本文介绍了CSS - 将div对齐到文本框的右侧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < div id =header> 
< div id =searchstyle =float:right; width:250px; padding:20px 6px 6px 6px;>
< form action =/method =getid =frmSiteSearchname =frmSiteSearch>
< input type =textid =searchboxname =keywordsize =20/>
< div style =width:22px; height:19px; float:left; background-color:green;>
< / div>
< / form>
< / div>
< / div>

和a jsbin在这里



我想让绿色背景的div出现在文本框的右侧。

解决方案

=keywordsize =20style =float:left;/>

这里的例子


    <div id="header">
        <div id="search" style="float:right;width:250px;padding:20px 6px 6px 6px;">
            <form action="/" method="get" id="frmSiteSearch" name="frmSiteSearch">
                <input type="text" id="searchbox" name="keyword" size="20"/>
                <div style="width:22px;height: 19px; float:left;background-color:green;">
                </div>
            </form>
        </div>          
    </div>

and a jsbin here.

I want to make the div with green background to appear right of the text box.

解决方案

Float the input left :

<input type="text" id="searchbox" name="keyword" size="20" style="float:left;"/>

Example here

这篇关于CSS - 将div对齐到文本框的右侧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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