tags:

views:

1597

answers:

6

Hi,

How do you increase the height of an textbox? (along with its font size)

+1  A: 

I'm assuming from the way you worded the question that you want to change the size after the page has rendered?

In Javascript, you can manipulate DOM CSS properties, for example:

document.getElementById('textboxid').style.height="200px";
document.getElementById('textboxid').style.fontSize="14pt";

If you simply want to specify the height and font size, use CSS or style attributes, e.g.

//in your CSS file or <style> tag
#textboxid
{
    height:200px;
    font-size:14pt;
}

<!--in your HTML-->
<input id="textboxid" ...>

Or

<input style="height:200px;font-size:14pt;" .....>
Paul Dixon
A: 

Don't the height and font-size CSS properties work for you ?

Cerebrus
A: 

Use CSS:

<html>
<head>
<style>
.Large
{
    font-size: 16pt;
    height: 50px;
}
</style>
<body>
<input type="text" class="Large">
</body>
</html>
James
Why are you using pt?
DrG
A: 

Increasing the font size on a text box will usually expand its size automatically.

<input type="text" style="font-size:16pt;">
Sam152
Good point, due to the question I was assuming he wanted to set both, however if it is just to increase the size of the textbox to fit the large text then this would be the ideal solution.
James
A: 
<input type="text" style="font-size:xxpt;height:xxpx">

Just replace "xx" with whatever values you wish.

Nate Shoffner
A: 

Note that if you want a multi line text box you have to use a <textarea> instead of an <input type="text">.

Jan Aagaard