Html 如何更改html文本框中的字体大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2117290/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 01:57:05  来源:igfitidea点击:

How to change font size in a textbox in html

html

提问by user225269

How can I change the font size of text inside the textbox in html.

如何更改 html 文本框中文本的字体大小。

回答by Pekka

For a <input type='text'>element:

对于<input type='text'>元素:

input { font-size: 18px; }

or for a <textarea>:

或为<textarea>

textarea { font-size: 18px; }

or for a <select>:

或为<select>

select { font-size: 18px; }

you get the drift.

你得到了漂移。

回答by tsbertalan

To actually do it in HTML with inline CSS (not with an external CSS style sheet)

使用内联 CSS 在 HTML 中实际执行(而不是使用外部 CSS 样式表)

<input type="text" style="font-size: 44pt">

A lot of people would consider putting the style right into the html like this to be poor form. However, I frequently make extreeemly simple web pages for my own use that don't even have a <html>or <body>tag, and such is appropriate there.

很多人会认为像这样将样式直接放入 html 是一种糟糕的形式。然而,我经常制作非常简单的网页供我自己使用,甚至没有<html><body>标签,这在那里是合适的。

回答by Stefana Muller

Here are some ways to edit the text and the size of the box:

以下是一些编辑文本和框大小的方法:

rows="insertNumber"
cols="insertNumber"
style="font-size:12pt"

Example:

例子:

<textarea rows="5" cols="30" style="font-size: 12pt" id="myText">Enter 
Text Here</textarea>