简体   繁体   English

更改字体大小和样式

[英]Change of font size and Style

Am currently working on a task in aspnet mvc project using c#.我目前正在使用 c# 处理 aspnet mvc 项目中的一项任务。 I aim at changing users input font Color and font style.我的目标是改变用户输入的字体颜色和字体样式。 Ie once a user types in something in a TextArea or TextBox, I want the program to Change the font to another font automatically.即,一旦用户在 TextArea 或 TextBox 中输入内容,我希望程序自动将字体更改为另一种字体。

 $('input').on('change',function(){ $('body').css('font-family',$('#font').val()); $('body').css('font-size',$('#size').val()+'px'); });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <input id="font" type="text" value="input font"/> <input id="size" type="text" value="inpupt size"/> <p> Sample Text </p>

<input id="font" type="text" value="input text font"/>
<input  id="size" type="text" value"input text size"/>
$('input').on('change',function(){
   var font = $('#font').val();
   var size = $('#size').val();
   $('body').css('font-size',size+'px');
   $('body').css('font-family',font);
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM