【问题标题】:How to make responsive side by side form elements如何使响应式并排表单元素
【发布时间】:2013-05-22 14:25:08
【问题描述】:

您是如何做到的,这样select 标记和text 输入将并排,而不管div 的宽度如何,同时还使text 输入响应式(占用100% 的宽度容器div)

CSS:

input[type="text"] { width: 100%; }

HTML:

<div style="width:500px; background:red; padding:10px;">
   <input type="text" name="test" style="float:left;"> 
   <select style="float:left;"><option>test</option></select>
</div>

示例:http://jsfiddle.net/F6Jtj/

【问题讨论】:

    标签: html css user-interface responsive-design


    【解决方案1】:

    你想用100%的宽度将它们对齐在同一条线上吗

    Demo

    <div class="wrap">
        <select>
            <option>Hello</option>       
            <option>World</option>
        </select>
        <span><input type="text" /></span>
    </div>
    
    .wrap span {
        display: block;
        padding-right: 5px;
        overflow: hidden;
    }
    .wrap input[type=text] {
        width: 100%
    }
    .wrap select {
        float: right
    }
    

    【讨论】:

    • 谢谢! select标签真的有必要放在input text之前吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-06-08
    • 1970-01-01
    • 2020-06-03
    • 2020-10-20
    • 2022-01-06
    • 1970-01-01
    • 2016-06-06
    相关资源
    最近更新 更多