42 users online (1 members and 41 guests)  


  Results 1 to 11 of 11

Related

  1. IE 6 text-align center problem    Forum: HTML Forum
    Replies: 5
  2. Align text with an image link?    Forum: HTML Forum
    Replies: 2
  3. text-align center problem - only in ie6    Forum: CSS Forum
    Replies: 4
  4. Align text to Centered table    Forum: HTML Forum
    Replies: 6
  1. #1
    Archer10's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2004
    Posts
    2

    Smile How do I align Text in the same line?

    Hi I have just started learning html and I need help. Im trying to align three names in the same line but with one name to the left, one to the center, and one to the right. Like so

    Peter Phil Duncan

    I tried using <div align="right"> but realized <div> automatically makes a new line making it like

    Peter
    Phil
    Duncan
    Then I was told to use <span class="alignLeft">
    But that also didn't work.

    If someone could help me here I would be very Grateful


  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hi, welcome to the forums.

    <span class="alignLeft"> isn't going to work on its own, it needs some CSS to go with it. Did you have any more code that that? Could you link to or post it?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    Archer10's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2004
    Posts
    2
    <div>
    <span class="alignLeft">Pete
    </span>
    <span class="alignCenter">Phil
    </span>
    <span class="alignRight">Duncan
    </span>
    </div>

    CSS? I will have to study that more I guess..

  4. #4
    priyanka's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Dec 2003
    Posts
    63
    If you get stuck and are in a hurry to find out what's exactly the solution, use Frontpage and do the changes and see how the coding is getting changed.If you are in need of good html tutorials, try out www.w3schools.com and www.htmlgoodies.com

  5. #5
    interpim's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2004
    Posts
    4
    You could try a table if it fits your page...

    <table>
    <tr>
    <td align="left">First Name</td>
    <td align="center">Middle Name</td>
    <td align="right">Last Name</td>
    </tr>
    </table>

  6. #6
    harikrishna.redd's Avatar
    New User

    Status
    Offline
    Join Date
    May 2007
    Posts
    1

    Smile Re: How do I align Text in the same line?

    <table>
    <tr><td>name:</td></tr>
    <tr><td>password:</td></tr>
    <tr><td>id:</td></tr>
    </table>
    Dont keep color, so that the o/p appears like
    name password id

  7. #7
    Bigmous's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Dec 2008
    Location
    Sydney, Australia
    Posts
    27

    Re: How do I align Text in the same line?

    div's are useful when controling the structure of the page. e.g. menu/nav, header/logo, paragraphs, columns, images. etc.

    but for only three words just use a table, remember to state the width of the table and align each cell accordinally in css.

    btw if you want give each name a seperate effect just give each cell its own class and you'll be able to control the font size color etc.

    hope that helps,

    mous

  8. #8
    Triz's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2010
    Posts
    1

    Re: How do I align Text in the same line?

    Quote Originally Posted by interpim View Post
    You could try a table if it fits your page...

    <table>
    <tr>
    <td align="left">First Name</td>
    <td align="center">Middle Name</td>
    <td align="right">Last Name</td>
    </tr>
    </table>
    If you have to images in one table (and can't create more tables) how would align them both to the left?

  9. #9
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: How do I align Text in the same line?

    Code:
    <div style="float:left;">One</div>
    <div style="float:left;">Two</div>
    <div style="float:left;">Three</div>

  10. #10
    wyg951's Avatar
    Disabled

    Status
    Offline
    Join Date
    Jul 2010
    Posts
    2

    Re: How do I align Text in the same line?

    I will have to study that more I guess

  11. #11
    KDavid01's Avatar
    Disabled

    Status
    Offline
    Join Date
    Jun 2010
    Posts
    6

    Re: How do I align Text in the same line?

    Use this.
    <table>
    <td align="right">
    <tr>
    </tr>
    <td/>
    <table/>

    I hope this will work.

    David.



Tags for this Thread