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
  1. #1
    New Coder
    Join Date
    Jun 2012
    Posts
    41
    Thanks
    14
    Thanked 1 Time in 1 Post

    resizing a textarea

    hey people, this is probably very simple, but ive got some problems regarding textarea, i am trying to insert a textarea within a table. the table is of a specified width, however for some reason when i insert the textarea within the table, it stretches the width of the table. for example if the width of the table is 100px, the textarea will be within the <td> tag..i have set the width of the <td> tag to 70px too, however for some reason when i insert the textarea within the <td>, it stretches the size of the table. ive tried to set the size within the textarea tag as you can see below:

    Code:
    <table width="100px">
    	<tr>
    	<td width="70px">
    	<textarea width="70px">
    	</textarea>
    	</td>
    	</tr>
    </table>
    but with no success

    i even tried to set the size on the css page as you can see below:

    Code:
    textarea {
    width: 70px;
    }
    with still no success

    would really appreciate it if someone could help

    thanx

  • #2
    Regular Coder
    Join Date
    Jul 2012
    Location
    London
    Posts
    473
    Thanks
    4
    Thanked 86 Times in 86 Posts
    Try:

    Code:
    <table width="100px">
    	<tr>
    	<td>
    		<textarea style="width: 272px; height: 131px">
    		</textarea>
    	</td>
    	</tr>
    </table>
    If you want to use css use a class i.e.

    Code:
    <style type="text/css">
    .textarea {
    	width:200px;
    	height:200px;
    
    }
    
    </style>
    </head>
    
    <body>
    <table width="100px">
    	<tr>
    	<td>
    		<textarea class="textarea">
    		</textarea>
    	</td>
    	</tr>
    </table></body>
    Last edited by tempz; 07-12-2012 at 08:21 PM.

  • Users who have thanked tempz for this post:

    Razzy (07-13-2012)

  • #3
    Regular Coder COBOLdinosaur's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    Generally a textarea will resist CSS. The correct way to dimension then is to use their rows and cols attributes.

    <textarea rows="3" cols="10">

    That way it will generate scrollbars is the content is too big.

    A textarea inside of a table is almost always a bad idea, because they will almost always end up with attributes that are in conflict.
    100% standards compliant code is 100% correct 100% of the time.
    one of my toys from my repository and perhaps some help getting help

    Cd&

  • Users who have thanked COBOLdinosaur for this post:

    Razzy (07-13-2012)

  • #4
    New Coder
    Join Date
    Jun 2012
    Posts
    41
    Thanks
    14
    Thanked 1 Time in 1 Post
    thank you very much chaps, i decided to use tempz code and it perfectly worked


  •  

    Posting Permissions

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