如何在textarea中显示粗体文本? [英] How can I display bold text in a textarea?

查看:1257
本文介绍了如何在textarea中显示粗体文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的代码:

 < textarea>< b>测试< / b>< / textrea> 

它显示原始HTML代码。相反,我希望它显示粗体文本。



我该如何实现这一目标?

解决方案

如果你想让textarea显示粗体文本,你可以通过css style属性来实现:

 < textarea style =font-weight:bold> test-text< / textarea> 

这会使textarea显示所有文本粗体,就像< ; b> text< / b>



然而,这会影响textarea中的所有文本。没有办法只显示一个粗体字。


I have this code:

<textarea><b>test</b></textrea>

It displays the raw HTML code. Instead, I would like it to simply display bold text.

How can I achieve that?

解决方案

If you want the textarea to display bold text, you can do that via css style attribute:

<textarea style="font-weight: bold">test-text</textarea>

This makes the textarea display all text bold, as it would be in <b>text</b>.

However, this affects all text in the textarea. There is no way to show only one word in bold.

这篇关于如何在textarea中显示粗体文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆