...

View Full Version : Label Length



Poddy
02-17-2009, 04:38 PM
Really basic question havn't done html in a very long time but anyway

how do i define a labels length

<label>ROUTER_ID</label><input type='text' size='10'Value='cabinet_ID'><BR>
<label>SERVER_ID</label><input type='text' size='10'Value='cabinet_ID'><BR>
<label>POWER_ID</label><input type='text' size='10'Value='cabinet_ID'><BR>
<label>CONNECTION_ID</label>
<input type='text' size='10'Value='cabinet_ID'><BR>

as you can see if i print these they with a textfield, all of the layout will look messy how would i straighten this up?

i just want the label length around 15 in size for all any ideas???

Apostropartheid
02-17-2009, 06:12 PM
15 what?

Labels are inline objects, by the way. You'll have to switch to block display to be able to declare explicit width.

Your code is horrible. A good, clean, readable and valid segment would appear like this:


<form action="" method="post">
<fieldset>
<label for="power-id">POWER-ID</label> <input type="text" value="cabinet_ID" name="power-id" id="power-id"/>
<label for="server-id">SERVER-ID</label> <input type="text" value="cabinet_ID" name="server-id" id="server-id"/>
<input type="submit" value="Submit"/>
</fieldset>
</form>
By the way, I have no idea how your form is going to work without input names/IDs.

abduraooft
02-18-2009, 08:36 AM
as you can see if i print these they with a textfield, all of the layout will look messy how would i straighten this up?
Apply some float to your label and then set a width (in CSS) like

label{
float:left;
width:/*whatever value with a unit */
}

VIPStephan
02-18-2009, 11:28 AM
Yes, to add to CyanLight’s statement: Labels need to be associated with a form control, otherwise they are pretty useless. So each form control (input/select/textarea that’s supposed to be associated with a label) needs to get a unique ID and each label needs a for attribute whose value equals the ID of the according form control. You can have multiple labels associated with the same form control, by the way.

Poddy
02-18-2009, 01:02 PM
could you use that in an example please?

BoldUlysses
02-18-2009, 01:09 PM
Have a look here (http://www.w3schools.com/tags/tag_label.asp).


<form>
<label for="male">Male</label>
<input type="radio" name="gender" id="male" />
<br />
<label for="female">Female</label>
<input type="radio" name="gender" id="female" />
</form>

Poddy
02-18-2009, 02:00 PM
that still don't solve the label length, all of those radio fields are not in line

abduraooft
02-18-2009, 02:12 PM
that still don't solve the label length, all of those radio fields are not in lineJust follow the article www.alistapart.com/articles/prettyaccessibleforms

VIPStephan
02-18-2009, 02:41 PM
And just follow the advice abduraooft just gave you in post #3. It’s that simple. (Except you may also need to apply clear: left to the labels.)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum