Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: How to align words in the same table cell?

  1. #1
    Join Date
    Jul 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to align words in the same table cell?

    I dont' know too much about CSS. Just wonder how to define style sheet class to align several words on the left and several words on the right in the same table cell?

    Another question is: what is the child node of table element?

    Thanks a lot!

  2. #2
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Well, unless you use layers, and unless you use two different cells, I don't see how you could do this. But, as usual, I'm probably wrong, because there's probably some different way to do this I'm unaware of. So, don't give up on this yet, but I can't see how it would be done.
    - Mike

  3. #3
    Join Date
    Jul 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for your fast reply!

    I didn't expect it was that hard! It's from an interview question.

    Do you know the answer for the second question?

    Thanks.

    Quote Originally Posted by mburt
    Well, unless you use layers, and unless you use two different cells, I don't see how you could do this. But, as usual, I'm probably wrong, because there's probably some different way to do this I'm unaware of. So, don't give up on this yet, but I can't see how it would be done.

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    I'm not sure on the other question.
    - Mike

  5. #5
    Join Date
    Jul 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you anyway!

    Quote Originally Posted by mburt
    I'm not sure on the other question.

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I think the child node of a table element is the TBODY.
    The ideal way to do this would be:
    Code:
    <td>
      <p style="text-align:left;">Some left-aligned text</p>
      <p style="text-align:right;">Some right-aligned text</p>
    </td>
    I don't know if it's valid to have <p>s inside a <td> though. If not, use separate table cells.

    mburt: The <layer> element has been obsolete since about Netscape 4 :-\ Nowadays we use <div>, or a more semantically-appropriate block-level element if one is available.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Jul 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you!

    I don't know if it is valid to put <p>s in a table cell either. But I tried it just now, the text simply went to seperate line and it didn't work.

    This is an interview question and I have to use same table cell to do this! It's really frustrating!

    Quote Originally Posted by Twey
    I think the child node of a table element is the TBODY.
    The ideal way to do this would be:
    Code:
    <td>
      <p style="text-align:left;">Some left-aligned text</p>
      <p style="text-align:right;">Some right-aligned text</p>
    </td>
    I don't know if it's valid to have <p>s inside a <td> though. If not, use separate table cells.

    mburt: The <layer> element has been obsolete since about Netscape 4 :-\ Nowadays we use <div>, or a more semantically-appropriate block-level element if one is available.

  8. #8
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    The <layer> element has been obsolete since about Netscape 4
    When I said layer, I meant <div>. I guess I wasn't specific enough
    - Mike

  9. #9
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    But, I still don't know how you would put it on the same line...
    - Mike

  10. #10
    Join Date
    Jul 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It's ok. I may tell them I don't know. Thank you!

    Quote Originally Posted by mburt
    But, I still don't know how you would put it on the same line...

Bookmarks

Posting Permissions

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