www.webdeveloper.com
Results 1 to 6 of 6

Thread: [RESOLVED] alignment of text in table columns

  1. #1
    Join Date
    Oct 2005
    Posts
    29

    resolved [RESOLVED] alignment of text in table columns

    How do you align parts of text but not the whole thing? for example if my source code is
    <tr><td>Bobby Rompel</td></tr>
    How do I make it so that the "Bobby" is aligned at the left of the column and "Rompel" at the right?

    Also if I have something like
    <input type="textbox" name="hm">

    how do I make it span the entire width of the page. I tried using something like size="100%" but it doesnt work. And if I type size="100" then it'll occuppy exactly 100 spaces, then what is the screen size is bigger or smaller?

  2. #2
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910

  3. #3
    Join Date
    Oct 2005
    Posts
    29

    Question

    Thanks, it does work.
    What if I have some text already on a line and I want the text box to span the rest of the line, can that be done?

    So if I want to do something like
    blahblahblah<input type="text" >
    what would I do?

    Also, can this technique also be applied to text areas, so that I can have a text area span the entire width of a table or page?

  4. #4
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    Yes, it should work on <textarea>s too.

    Try this.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <title></title>
    <style type="text/css">
    
    label span {
      float: left;
    }
    
    span.maxAvailWidth {
      margin-left: 7em;
      display: block;
      width:auto;
      float: none;
      background-color: #f00;
    }
    span.maxAvailWidth input {
      width: 95.9%;
    }
    
    </style>
    </head>
    <body>
    
    <form action="#"><div>
    <label><span>label</span>
    <span class="maxAvailWidth"><input type="text"></span></label>
    </div></form>
    
    </body>
    </html>

  5. #5
    Join Date
    May 2005
    Location
    New Zealand
    Posts
    113
    a simple way would be to do this:

    <div align="left">Bobby</div> <div align="right">Rompel</div>

    It wont validate with XHTML Strict though

  6. #6
    Join Date
    Oct 2005
    Posts
    29
    Nitrexodide,

    Wont what you suggested do something like

    Bobby

    Rompel

    Because dont divs have built in line feeds?
    Last edited by shashgo; 04-01-2006 at 10:31 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