Changing The Font Of Text Area

有些话、适合烂在心里 提交于 2020-08-03 12:52:19

问题


I think this is a simple and a silly question. I have included a text area in my html script.

Is it possible to change the default font of the text area?

The default one doesn't look good. I hope there is a way to change it.


回答1:


Yes, using the CSS font-family property, just like any other element.

The W3C has a CSS tutorial as does Mozilla




回答2:


You can just open your css file and write code as mentioned below

textarea  
{  
   font-family:"Times New Roman", Times, serif;  
   font-size: 12px;   
}

By following the above procedure, you can change the default property of any HTML tag you want.




回答3:


And the shortcut lazy version (not recommended):

    <textarea rows="5" cols="50" 
     style="font-family:Times New Roman;color:#003399;white-space:pre-wrap">Put your text here</textarea>



回答4:


You can also use the font short hand version

textarea
{
    font: 12px "Times New Roman", Times, serif;
}

The values:

font: font-style font-variant font-weight font-size/line-height font-family;


来源:https://stackoverflow.com/questions/11094981/changing-the-font-of-text-area

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!