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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

aligning problem with input

Status
Not open for further replies.
Unless you want to use tables, I'd go with floating each element to the left to do this. Then, just clear left on each of the labels.

If you want to avoid a nasty bug in NN7.0 where styled labels don't show, then put a span around then, and float that instead. Then give it a width.

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Dan, could you give me a example how i should do it.
 
Here's something that should help you get started with this. This CSS:

Code:
<style type="text/css">
	.inputRow {
		clear: left;
	}
	.inputRowLabel {
		width: 10em;
		float: left;
	}
	.inputRowField {
		width: 10em;
		float: left;
	}
</style>

with this HTML:

Code:
<div class="inputRow">
	<span class="inputRowLabel">
		<label for="someField">This is field 1</label>
	</span>
	<span class="inputRowField">
		<input type="text" id="someField" />
	</span>
</div>

works fine for me with an XHTML 1.1 DOCTYPE.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top