【问题标题】:Form horizontal layout with labels on top through css通过css形成顶部带有标签的水平布局
【发布时间】:2012-07-10 02:25:20
【问题描述】:

我想要一个表单,其中包含多个水平(彼此相邻)布局的选择控件,并且每个选择的顶部都有标签。

像这样:

Inline form fields with labels placed on top

如何使用 css 和 dform 做到这一点?

【问题讨论】:

  • 我不知道dform,但是您链接到的问题的答案有什么问题..?

标签: jquery css forms select label


【解决方案1】:

我认为最好只使用无序列表。

将 LI 元素向左浮动并给它们一些margin-right 以分隔它们。

您需要在 UL 或其父元素上添加一个 clearfixer 元素,以确保浮动有效。

<ul>

<li><label>Label #1</label>
<select>
<option></option>
</select>
</li>

<li><label>Label #1</label>
<select>
<option></option>
</select>
</li>

<li><label>Label #1</label>
<select>
<option></option>
</select>
</li>

</ul>

【讨论】:

    【解决方案2】:

    这是使用 dform 的答案。谢谢你的反对票。

    跨度的css...显示:内联块 标签和选择...显示:块

    $('#myform').dform({ "action" : "dform.html", "method" : "get", "html" : [
    { "type": "span", "html": { "type": "select", "name": "Country", "caption": "Country", "class": "countries", "options": { "": "All", "USA": { "html": "USA", "class": "active" }, "Germany": { "html": "Germany", "class": "active" }, "France": { "html": "France", "class": "active" } }, "selected": null } } ] });

    【讨论】:

    • 这只是一个select类型,我需要在第一个水平方向上多放一个select;它不适合我
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-18
    • 1970-01-01
    • 1970-01-01
    • 2013-03-23
    相关资源
    最近更新 更多