html - CSS 表单样式帮助内联 dt/dd 元素

标签 html css

我需要帮助设计搜索(数据过滤器)表单。我想要的是让标签文本右对齐,文本框位于标签的右侧。但我希望开始和结束日期的从/到标签和文本都在同一行,包括搜索按钮。我怎样才能实现这种影响?

参见附件示例线框,search mockup

我正在使用 http://gawibowo.com/theme/adminique/forms.html 中的表单样式.我能够正确显示“选择元素”标签/输入和“发件人”标签/输入,它在与我遇到问题的“发件人”相同的行上显示“收件人”标签/输入和按钮.

当前 html

<form accept-charset="UTF-8" action="http://localhost:3000/reports/report/realtime-transaction-activity" class="filter" data-remote="true" id="realtime_transaction_activity_form" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="?"><input name="authenticity_token" type="hidden" value="GTpmMlHkQSkoRdBgjcVYQGJOyf6UX9brW5yzVY/MrHY="></div>
 <div class="group">
    <dl class="inline">
      <dt>
        <label class="label" for="terminals">Terminals:</label>
      </dt>
      <dd>
        <select id="terminals" multiple="multiple" name="terminals[]" width="400" style="display: none; "><option value="3417">Midland U Cafeteria - A005</option>
        <option value="3686">Midland UBookstore - A201</option></select><button type="button" class="ui-multiselect ui-widget ui-state-default ui-corner-all" aria-haspopup="true" tabindex="0" style="width: 225px; "><span class="ui-icon ui-icon-triangle-2-n-s"></span><span>Select options</span></button>
      </dd>
      <dt>
        <label class="label" for="from">From:</label>
      </dt>
      <dd>
        <input class="text_field hasDatepicker" id="from" name="from" required="required" type="text">
        <div class="to">
          <label class="label" for="to">To:</label>
          <input class="text_field hasDatepicker" id="to" name="to" required="required" type="text">
          <button class="button small" data-disable-with="Please wait..." name="button" type="submit">Search</button>
          <img alt="Ajax-loader" id="ajax_loader" src="/assets/ajax-loader.gif" style="display:none">
        </div>
      </dd>

    </dl>
    <br>
  </div>
</form>

css(用于 form/dl/dt/dd 元素)

form dt {
margin-bottom: 2px;
}
form dd {
    margin-bottom: 15px;
}
form dt label {
    cursor: pointer;
    font: 11px Tahoma, sans-serif;
    font-weight: bold;
    color: #555;
}

form p {
    clear: left;
    margin-bottom: 0;
    padding: 5px 0;
    width: 100%;
}
form p label {
    display: block;
    float: left;
    cursor: pointer;
    font: 11px Tahoma, sans-serif;
    font-weight: bold;
    color: #555;
    width: 100px;
    vertical-align: middle;
    padding: 5px;
    text-align: right;
    margin-right: 10px;
}
form p small {
    display: block;
    margin: 0 10px 0 120px;
    font-size: 10px;
    color: #aaa;
}

form dl.inline dt {
    clear: both;
    width: 25%;
    float: left;
    text-align: right;
}
form dl.inline dt label {
    margin-right: 12px;
}
form dl.inline dd {
    float: left;
    width: 74%;
    margin: 0 0 15px;
}

最佳答案

尝试 float dd 中的其他元素。

form dd input, form dd label, form dd button {float:left; }​

fiddle

关于html - CSS 表单样式帮助内联 dt/dd 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9520516/

相关文章:

css - 为整个网站动态更新 CSS 类

javascript - Safari 浏览器无法处理 Click 事件以显示加载图像

html - CSS 样式 html 表单

html - 在一个文本的右边放一条线,然后在另一个文本的右边放一条线,这样下面的线就有相同的水平尺寸。 CSS

html - CSS Transition 和复选框标签的问题

php - 重定向到一个新页面,其中包含 Javascript 中的发布数据

javascript - 如何从 npm install 中包含样式表和 javascript

CSS - 显示 : table-cell not working properly

html - 使用 SASS mixin 时 CSS 编译错误

html - Angular : Incorrect Alignment using ng-repeat and ng-include