www.webdeveloper.com
Results 1 to 4 of 4

Thread: two labels in a div

  1. #1
    Join Date
    Nov 2004
    Location
    xxxyyy
    Posts
    357

    two labels in a div

    I want to put two labels in a div...like below..


    Label : some value <-----some gap-----> Label: another value.



    can you please tell how to code this in HTML ?

  2. #2
    Join Date
    Mar 2012
    Posts
    1,111
    If you mean IDs not labels, IDs apply to any HTML element. So you can apply one to the div as a whole and another to a paragraph etc...

    E.g.

    <div id="div1">
    <p>some text.</p>
    <p id="p2">second paragraph.</p>
    </div>

    Labels are different, they apply to input fields on forms. They do not apply to divs.
    Last edited by jedaisoul; 08-22-2013 at 04:58 AM.

  3. #3
    Join Date
    Nov 2004
    Location
    xxxyyy
    Posts
    357
    >>>they apply to input fields on forms.

    I am using input fields.

    inside div I am putting two labels.

  4. #4
    Join Date
    Mar 2012
    Posts
    1,111
    Then what is your problem??? The basic rules of using labels are:

    1. Use label tags to enclose a single input field and the label text. E.g.

    <label><input>label text</label>

    Is correct.

    2. Enclosing multiple input fields with a label is wrong. E.g.

    <label><input>label text<input>label text</label>

    Does not work.

    3. If you want to put the labels separate from the input fileds, use the <label for "name"> syntax. See here.
    Last edited by jedaisoul; 08-23-2013 at 03:47 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles