我想知道如何用html编写代码来大写替代词 [英] i want to know how to write a code in html to capitalize alternative words
本文介绍了我想知道如何用html编写代码来大写替代词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一句话
例如我是Manda Arpitha
我想知道如何在html中编写代码。打印为
我可以使用文本来做到这一点。
解决方案 -console =truedata-babel =false>
< pre class =snippet-code-html lang-html prettyprint-override div>我是Manda Arpitha< style onload ='var p = this.parentNode; p.innerHTML = p.innerText.replace(/(\ s \s *)(\SS)/ g,(m,a,b)=> a.toUpperCase()+ b.toLowerCase() )'/>< / div>
一个href =https://www.w3schools.com/tags/att_onload.asp =nofollow noreferrer> onload
事件运行时,div文本和样式标记被替换:
< div> I aM mAnDa ArPiThA< / div>
i have a sentence for example "I am Manda Arpitha"
i want to know how to write a code in html.. to make it print as
I aM mAnDa ArPiThA.
can we do it using the text tranform attribute of css
?
how to do that?
解决方案
It's a bit hacky but:
<div>I am Manda Arpitha<style onload='var p = this.parentNode; p.innerHTML = p.innerText
.replace(/(\S\s*)(\S?)/g, (m, a, b) => a.toUpperCase() + b.toLowerCase())'/></div>
After the onload
event runs, the div text and style tag are replaced:
<div>I aM mAnDa ArPiThA</div>
这篇关于我想知道如何用html编写代码来大写替代词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文