Pau*_*xon 53
我假设您想要在页面呈现后更改大小的问题.
在Javascript中,您可以操纵DOM CSS属性,例如:
document.getElementById('textboxid').style.height="200px";
document.getElementById('textboxid').style.fontSize="14pt";
Run Code Online (Sandbox Code Playgroud)
如果您只想指定高度和字体大小,请使用CSS或样式属性,例如
//in your CSS file or <style> tag
#textboxid
{
height:200px;
font-size:14pt;
}
<!--in your HTML-->
<input id="textboxid" ...>
Run Code Online (Sandbox Code Playgroud)
要么
<input style="height:200px;font-size:14pt;" .....>
Run Code Online (Sandbox Code Playgroud)
增加文本框上的字体大小通常会自动扩展其大小.
<input type="text" style="font-size:16pt;">
Run Code Online (Sandbox Code Playgroud)
如果你想设置一个与字体大小不成比例的高度,我建议你使用如下的东西.这可以防止像IE这样的浏览器在顶部而不是垂直居中渲染文本.
.form-text{
padding:15px 0;
}
Run Code Online (Sandbox Code Playgroud)
<input type="text" style="font-size:xxpt;height:xxpx">
Run Code Online (Sandbox Code Playgroud)
只需将“xx”替换为您想要的任何值即可。
使用内联样式:
<input type="text" style="font-size: 18pt; height: 40px; width:280px; ">
Run Code Online (Sandbox Code Playgroud)或者使用单独的CSS:
HTML:
<input type="text" id="txtbox">
Run Code Online (Sandbox Code Playgroud)
CSS:
<input type="text" style="font-size: 18pt; height: 40px; width:280px; ">
Run Code Online (Sandbox Code Playgroud)