找到html块中最宽的单词的宽度 [英] Find the width of the widest word in the html block
本文介绍了找到html块中最宽的单词的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这个文本是一个由不同字体的单词组成的句子,如图所示。
/ p>
html看起来像:
< span style =font:bold 14px Verdana;> LONGESTW< / span>
< span style =font:bold 42px Verdana;> ORD< / span>
< span style =font:bold 14px Verdana;>& nbsp;< / span>
< span style =font:bold 24px Verdana;> ORD< / span>
< span style =font:bold 14px Verdana;>& nbsp;< / span>
< span style =font:bold 24px Verdana;>常规< / span>
< span style =font:bold 14px Verdana;>& nbsp;< / span>
< span style =font:bold 32px Verdana;> w< / span>
< span style =font:bold 96px Verdana;> id< / span>
< span style =font:bold 64px Verdana;> est< / span>
所以,这里的第三个单词是最宽的。有任何想法吗?一切都是html,我们可以使用任何东西(jquery,ES5技术等)。 解决方案
我认为这假装是一个解决方案。
http://jsfiddle.net/WtcEQ/ 4 /
The goal is to find the width of the widest word here.
The text is a sentence consisting of words with different fonts, as shown in the image.
the html looks like :
<span style="font:bold 14px Verdana;">LONGESTW</span>
<span style="font:bold 42px Verdana;">ORD</span>
<span style="font:bold 14px Verdana;"> </span>
<span style="font:bold 24px Verdana;">ORD</span>
<span style="font:bold 14px Verdana;"> </span>
<span style="font:bold 24px Verdana;">regular</span>
<span style="font:bold 14px Verdana;"> </span>
<span style="font:bold 32px Verdana;">w</span>
<span style="font:bold 96px Verdana;">id</span>
<span style="font:bold 64px Verdana;">est</span>
So, here the 3rd word is the widest. Any ideas? Everything is html and we can use any thing ( jquery,ES5 techniques etc).
解决方案
I think this pretends to be a solution.
这篇关于找到html块中最宽的单词的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文