-3

I'd like to have a form with several select controls in a horizontal (they are next to each other) layout and have labels on top of each select.

Like this:

Inline form fields with labels placed on top

How can I do that with css and using dform?

Community
  • 1
  • 1
Muff
  • 75
  • 2
  • 8

2 Answers2

0

Best to just use an unordered list I think.

Float the LI elements to the left and give them some margin-right to space them.

You'll need a clearfixer element on the UL or it's parent to make sure the float works.

<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>
Billy Moat
  • 20,792
  • 7
  • 45
  • 37
0

Here is the answer using dform. Thank you for negative voting.

css for span... display:inline-block label and select... display : block

$('#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 } } ] });

Muff
  • 75
  • 2
  • 8
  • this is only one `select` type, I need to put one more `select` horizontally to first one; it is not working for me – Coding world Jul 02 '19 at 10:06