Search code examples
asp.nethtmlcssdictionarystylesheet

Arranging dynamically generated Labels and aspx-Controls to look like a Dictionary without using table


I'd like to have a Page-Structure like the following:

Label1    |    (CheckBox or DropDown or TextBox etc.)<br>
Label2    |    (CheckBox or DropDown or TextBox etc.)<br>
Label3    |    (CheckBox or DropDown or TextBox etc.)

with this exact schema, considering that e.g. TextAreas take up more space whilst still making sure that Label and corresponding aspx-Control are on the same height.

I cannot know which Controls will appear since this is bound to the Parameters that are given to the form.

I was thinking about having a div for Labels and a div for Controls, arranging them next to each other and giving .divLeft span some kind of fixed height and margin that'd be appropriate for whatever Controls I put on the right side.

Any Ideas?


Solution

  • In the end the method we went with was having one div, in which we added Labels having float:left and width:50%, controls with the same stats and afterwards a placeholder-span with float:left and width:100%. It looks like a table and is arranged like one, but doesn't have the disadvantages of actual tables.