Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9

Thread: Label Length

  1. #1
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Label Length

    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???

  • #2
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    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:
    Code:
    
    <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.

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    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
    Code:
    label{
    float:left;
    width:/*whatever value with a unit */
    }
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,927
    Thanks
    6
    Thanked 1,041 Times in 1,014 Posts
    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.

  • #5
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    could you use that in an example please?

  • #6
    Regular Coder BoldUlysses's Avatar
    Join Date
    Jan 2008
    Location
    Winston-Salem, NC
    Posts
    938
    Thanks
    10
    Thanked 190 Times in 187 Posts
    Have a look here.

    Code:
    <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>
    matt | design | blog

  • #7
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    that still don't solve the label length, all of those radio fields are not in line

  • #8
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Quote Originally Posted by Poddy View Post
    that still don't solve the label length, all of those radio fields are not in line
    Just follow the article http://www.alistapart.com/articles/p...ccessibleforms
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #9
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,927
    Thanks
    6
    Thanked 1,041 Times in 1,014 Posts
    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.)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •