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 4 of 4

Thread: set width

  1. #1
    Senior Coder
    Join Date
    May 2004
    Posts
    1,456
    Thanks
    15
    Thanked 0 Times in 0 Posts

    set width

    I'm trying to move away from tables.

    I'm trying to do somethign simple.

    I have 4 lines of text with a textbox next to each.
    I want to align it so all the text boxes start at the same place.
    this is easy to do with a table was I was wondering if it can also be easily done with css??

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Sure, but can you show us your code that you have already? CSS and HTML and if possible a link to the site with minimal code just enough to test?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Senior Coder
    Join Date
    May 2004
    Posts
    1,456
    Thanks
    15
    Thanked 0 Times in 0 Posts
    i didn't really add the css yet. Normally I do this with tables.

    Example

    line 1 <input type=text name=line1><br>
    line 2 <input type=text name=line1><br>
    line 3 <input type=text name=line1><br>
    line 4 <input type=text name=line1><br>


    Normally I would just make this a table with 2 collumns.

    Is there a better way in css?

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    There is more than one way to do what you want. This is one of them.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>2 Column Form without Table</title>
    <style type="text/css">
    body {
    font-size:11px;
    font-family:Verdana, Arial, Helvetica, sans-serif;
    margin:5px;
    padding:0;
    }
    #container {
    margin:auto;
    width:242px;
    width:247px; !important /*for IE*/
    }
    #container label {
    width:40px;
    float:left;
    line-height:18px;
    margin:3px 0;
    clear:left;
    display:inline;
    }
    #container input {
    margin:3px 0;
    width:200px;
    font-size:11px;
    font-family:Verdana, Arial, Helvetica, sans-serif;
    border:1px solid #000;
    }
    </style>
    </head>
    
    <body>
    <form action="#" method="post">
    <div id="container">
    <label for="line1">line 1</label><input type="text" name="line1" id="line1"><br>
    <label for="line2">line 2</label><input type="text" name="line2" id="line2"><br>
    <label for="line3">line 3</label><input type="text" name="line3" id="line3"><br>
    <label for="line4">line 4</label><input type="text" name="line4" id="line4">
    </div>
    </form>
    </body>
    </html>
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

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