Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form elements alignment

Status
Not open for further replies.

matrixindicator

IS-IT--Management
Sep 6, 2007
418
0
0
BE
Basic question. When using a form with its elements (input types and labels), how to align these, with CSS, does there exist something like tab in html, I suppose putting these elements in a table is absolutely not done, forbidden ?

Code:
<div id="content">

<form method="post" action="_010FRMIN.php">
<label for="liters">LITERS:</label>
<input type="text" id="liters" name="liters" /><br />
<input type="submit" name="submit" value="Send" />
</form>
</div>
 
Hi

My usual approach :
CSS:
form p [teal]{[/teal]
  [blue]clear:[/blue] [green]left[/green];
[teal]}[/teal]

form p label [teal]{[/teal]
  [blue]float:[/blue] [green]left[/green];
  [blue]width:[/blue] [green]3.5em[/green];
  [blue]text-align:[/blue] [green]right[/green];
  [blue]margin-right:[/blue] [green]3px[/green];
[teal]}[/teal]
Code:
[b]<form[/b] [maroon]action[/maroon][teal]=[/teal][green][i]""[/i][/green][b]>[/b]

[b]<p>[/b]
[b]<label[/b] [maroon]for[/maroon][teal]=[/teal][green][i]"one"[/i][/green][b]>[/b]One[b]</label>[/b]
[b]<input[/b] [maroon]type[/maroon][teal]=[/teal][green][i]"text"[/i][/green] [maroon]name[/maroon][teal]=[/teal][green][i]"one"[/i][/green] [maroon]id[/maroon][teal]=[/teal][green][i]"one"[/i][/green][b]>[/b]
[b]</p>[/b]

[b]<p>[/b]
[b]<label[/b] [maroon]for[/maroon][teal]=[/teal][green][i]"two"[/i][/green][b]>[/b]Two[b]</label>[/b]
[b]<input[/b] [maroon]type[/maroon][teal]=[/teal][green][i]"text"[/i][/green] [maroon]name[/maroon][teal]=[/teal][green][i]"two"[/i][/green] [maroon]id[/maroon][teal]=[/teal][green][i]"two"[/i][/green][b]>[/b]
[b]</p>[/b]

[b]<p>[/b]
[b]<label[/b] [maroon]for[/maroon][teal]=[/teal][green][i]"three"[/i][/green][b]>[/b]Three[b]</label>[/b]
[b]<input[/b] [maroon]type[/maroon][teal]=[/teal][green][i]"text"[/i][/green] [maroon]name[/maroon][teal]=[/teal][green][i]"three"[/i][/green] [maroon]id[/maroon][teal]=[/teal][green][i]"three"[/i][/green][b]>[/b]
[b]</p>[/b]

[b]</form>[/b]
matrixindicator said:
I suppose putting these elements in a table is absolutely not done, forbidden ?
Depends on the data. If it is kind of structured data, you can represent it in tabular format, just go with [tt]table[/tt].

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top